- This topic has 9 replies, 2 voices, and was last updated 3 years, 4 months ago by
Leo.
-
AuthorPosts
-
September 24, 2019 at 1:19 pm #1018013
Carrie
Good afternoon! I’m trying to insert Font Awesome icons at the bottom of each blog post using the generate_after_content hook, and I don’t really understand how to do this. After reading the help documentation, I came up with the below code, but publishing it generates an error message – “Parse error: syntax error, unexpected ‘}’, expecting end of file in /home/carriemo/public_html/wp-content/plugins/gp-premium/elements/class-hooks.php(180) : eval()’d code on line 7.”
Would you mind telling me how to correct it?
add_action( ‘generate_after_content’,’social_icons’ );
function example_function_name() { ?> <i class=”fa-icon-linkedin”></i> <i class=”fa-icon-instagram”></i> <i class=”fa-icon-facebook”></i> <i class=”fa-icon-twitter”></i>
<?php }September 24, 2019 at 1:25 pm #1018020Leo
StaffCustomer SupportHi there,
Have you loaded FA? If not I would recommend installing this plugin first:
https://wordpress.org/plugins/font-awesome/Then you can add the HTML below as hook element content:
<i class="fa-icon-linkedin"></i>
https://docs.generatepress.com/article/hooks-element-overview/Let me know if this helps 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 24, 2019 at 1:29 pm #1018027Carrie
Font Awesome caused my mobile page speed to crash. I’ve been using it in the header without the plugins and don’t have any issues.
September 24, 2019 at 1:32 pm #1018032Leo
StaffCustomer SupportGP itself doesn’t load FA by default. So if you are able to use it somewhere else, likely another plugin (page builders) is loading it for you.
If you are using hooks element, then you don’t need the
add_action
part, simply add the HTML part like this:
<i class="fa-icon-linkedin"></i><i class="fa-icon-facebook"></i><i class="fa-icon-instagram"></i>
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 24, 2019 at 1:33 pm #1018034Carrie
September 24, 2019 at 1:35 pm #1018042Leo
StaffCustomer SupportMake sure you see the second paragraph of my reply 🙂
https://generatepress.com/forums/topic/social-icons-in-the-blog-footer-using-generate_after_content/#post-1018032Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/September 24, 2019 at 1:43 pm #1018048Carrie
Like this? It seems to match yours, except for including the link, but nothing shows up. It’s blank.
<i class=”fa-icon-linkedin” aria-hidden=”true”></i>
<i class=”fa-icon-instagram” aria-hidden=”true”></i>
<i class=”fa-icon-facebook” aria-hidden=”true”></i>
<i class=”fa-icon-twitter” aria-hidden=”true”></i>September 24, 2019 at 2:49 pm #1018103Carrie
Although blank is probably better than an error code! LOL
September 24, 2019 at 2:54 pm #1018104Carrie
Never mind, I got it! The word “icon” has to be removed. It no longer uses it.
It’s “fa fa-facebook” as an example, not “fa fa-icon-facebook.”
Thank you so much for your help… I appreciate it.September 24, 2019 at 3:13 pm #1018120Leo
StaffCustomer SupportGlad you’ve figured out 🙂
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/ -
AuthorPosts
- You must be logged in to reply to this topic.