• Skip to main content
  • Skip to forum navigation

StudioPress

  • Shop for Themes
  • My StudioPress

Forum navigation

  • Home
  • General Genesis Discussions
  • StudioPress Themes
  • Genesis Blocks
    • Genesis Blocks
    • Genesis Custom Blocks
  • Retired Themes
  • FAQs
  • Forum Rules
  • Internationalization and Translations
  • Forum Bugs and Suggestions
  • Forum Log In

Are You Using The WordPress Block Editor?

Genesis now offers plugins that help you build better sites faster with the WordPress block editor (Gutenberg). Try the feature-rich free versions of each plugin for yourself!

Genesis Blocks Genesis Custom Blocks

How to insert Facebook Like Button via functions.php in eleven40 Pro?

Welcome!

These forums are for general discussion on WordPress and Genesis. Official support for StudioPress themes is offered exclusively at My StudioPress. Responses in this forum are not guaranteed. Please note that this forum will require a new username, separate from the one used for My.StudioPress.

Log In
Register Lost Password

Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to insert Facebook Like Button via functions.php in eleven40 Pro?

This topic is: not resolved

Tagged: Eleven40-Pro, Facebook Like, functions.php

  • This topic has 4 replies, 2 voices, and was last updated 12 years, 3 months ago by Chris Moore.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • August 21, 2013 at 3:23 pm #58021
    Chris Moore
    Member

    Hello there everyone!

    I was wondering if someone could please help me to insert the following code at the top of EVERY post in the Eleven40 Pro theme via the functions.php file:

    <div class="fb-like fb-post-info" data-href="'. get_permalink() .'" data-send="false" data-layout="button_count" data-width="90" data-show-faces="false"></div>

    I would like the Facebook like button this will generate to appear exactly next to (not after) the entry-meta (like so):

    By Lindsey Coulter – Leave a Comment FACEBOOK LIKE

    Thanks so much!

    Respectfully,
    Chris M.


    Resepctfully, Chris Moore
    Web Dev, CSS Hacks, & Biz Consulting @ MooreCreativeIdeas.com / Blogging @ ReflectOnThis.com

    http://reflectonthis.com
    August 21, 2013 at 3:28 pm #58022
    Chris Moore
    Member

    This is actually the code I want inserted (it doesn't really matter though, as I am really only after the function and/or action I need to use in the functions.php):

    <div class="fb-like" data-href="'. get_permalink() .'" data-width="90" data-layout="button_count" data-show-faces="false" data-send="false"></div>


    Resepctfully, Chris Moore
    Web Dev, CSS Hacks, & Biz Consulting @ MooreCreativeIdeas.com / Blogging @ ReflectOnThis.com

    August 21, 2013 at 3:59 pm #58039
    cdils
    Participant

    Hi Chris,
    I highly recommend using the Genesis Visual Hook Guide plugin to see where you can hook in on your pages.

    If you want to go above the post title, try hooking into either genesis_before_entry or genesis_entry_header.

    Unless you're using a custom template, you'll need to add something like this to your functions.php:

    
    add_action ( 'genesis_before_entry', 'my_post_extras' );
    
    function my_post_extras() {
          if ( ! is_single() )
               return;
       
          echo 'blah blah'; // add custom output here
    }
    

    I didn't test that code, so use with caution. 🙂

    Carrie


    Have you been helped in this forum? Pay it forward and answer someone else’s question. I bet you’ll know the answer to at least one question. 🙂

    I host a weekly WordPress-focused podcast called Office Hours. I tweet @cdils.

    August 21, 2013 at 4:06 pm #58042
    Chris Moore
    Member

    Thanks so much Carrie (@cdils)!

    Unfortunately, that puts the Like button ABOVE, and only on the post, not the homepage as well (sorry, should have been more clear about that).

    I would like it right next to the part that says:

    By Lindsey Coulter – Leave a Comment FACEBOOK LIKE

    The site in question: http://ReflectOnThis.com


    Resepctfully, Chris Moore
    Web Dev, CSS Hacks, & Biz Consulting @ MooreCreativeIdeas.com / Blogging @ ReflectOnThis.com

    August 21, 2013 at 5:16 pm #58064
    Chris Moore
    Member

    Okay, here's what I did. I basically applied a solution that I have used in the past, which involves creating a shortcode that I can then insert into the appropriate place with the Genesis - Simple Edits plugin.

    Here is what I did:

    // Add a shortcode for Facebook "Like" insertion ([FB-Like-Shortcode])
    	function moore_fb_like_shortcode() {
    		if ( is_single () || is_home() )
    		return '<span class="fb-like fb-post-info" data-href="'. get_permalink() .'" data-send="false" data-layout="button_count" data-width="90" data-show-faces="false"></span>';
    	}
    	add_shortcode('FB-Like-Shortcode', 'moore_fb_like_shortcode');

    Then I just drop [FB-Like-Shortcode] where I want it to appear in the Genesis - Simple Edits plugin, and voila!

    I was hoping to get a simpler, purely functions.php solution, so if anyone knows how, please do enlighten me!

    Reference site: http://ReflectOnThis.com

    Thanks again!


    Resepctfully, Chris Moore
    Web Dev, CSS Hacks, & Biz Consulting @ MooreCreativeIdeas.com / Blogging @ ReflectOnThis.com

  • Author
    Posts
Viewing 5 posts - 1 through 5 (of 5 total)
  • The forum ‘Design Tips and Tricks’ is closed to new topics and replies.

CTA

Ready to get started? Create a site or shop for themes.

Create a site with WP EngineShop for Themes

Footer

StudioPress

© 2025 WPEngine, Inc.

Products
  • Create a Site with WP Engine
  • Shop for Themes
  • Theme Features
  • Get Started
  • Showcase
Company
  • Brand Assets
  • Terms of Service
  • Accptable Usse Policy
  • Privacy Policy
  • Refund Policy
  • Contact Us
Community
  • Find Developers
  • Forums
  • Facebook Group
  • #GenesisWP
  • Showcase
Resources
  • StudioPress Blog
  • Help & Documentation
  • FAQs
  • Code Snippets
  • Affiliates
Connect
  • StudioPress Live
  • StudioPress FM
  • Facebook
  • Twitter
  • Dribbble