• 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 can I insert the Facebook Like button code in the post-info DIV?

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 can I insert the Facebook Like button code in the post-info DIV?

This topic is: resolved

Tagged: Eleven40, Facebook Like

  • This topic has 4 replies, 1 voice, and was last updated 12 years ago by Chris Moore.
Viewing 5 posts - 1 through 5 (of 5 total)
  • Author
    Posts
  • May 28, 2013 at 2:15 pm #42946
    Chris Moore
    Member

    Hello,

    I am trying to insert the following code to make the Facebook "Like" button appear after the comments count in the `post-info` `div` of the eleven40 child theme.

    (Imagine this code is wrapped in a `div`...)

    `class="fb-like" data-send="false" data-layout="button_count" data-width="90" data-show-faces="false" data-font="trebuchet ms"`

    Here is the website in question: ReflectOnThis.com

    I am currently using a very inelegant workaround to get the "Like" buttons to show up on the `single post` pages, but I want to find a better way. (The "Like" buttons don't show on the homepage, so that is another problem that I am hoping to solve with the proper implementation of this).

    So, how can I get the Facebook Like buttons to output in the loop of each post, on both `single post` pages and the `home` page?

    Thanks!


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

    May 28, 2013 at 2:27 pm #42948
    Chris Moore
    Member

    I figured out one thing that I was missing: I needed to explicitly pull the `href` like this:

    `data-href="'. get_permalink() .'"`

    Now my issue is how to insert the code I now have (which works!) directly into the right place in the theme template files (or via `functions.php`).

    I would like the code to be inserted exactly after the comments count at the top of each post, in the `post-info` `div`.

    Anyone? 🙂


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

    May 28, 2013 at 2:41 pm #42951
    Chris Moore
    Member

    Do I basically have to unhook the `genesis_post_info()` function to get rid of the current Post Info and then place my code using the `genesis_before_post_content` hook?

    What would the exact function look like and how would I replace the existing Post Info code, while adding the Facebook Like code snippet as well?


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

    May 28, 2013 at 2:46 pm #42952
    Chris Moore
    Member

    Here is my current solution (which actually works):

    I created a shortcode function, like so:

    `// Add a shortcode for Facebook "Like" insertion
    function reflect_fb_shortcode() {
    if ( is_single () || is_home() )
    return '';
    }
    add_shortcode('FB-Like-Shortcode', 'reflect_fb_shortcode');`

    Then I just dropped the newly created shortcode [FB-Like-Shortcode] exactly where I want it using the Genesis Simple Edits plugin.

    Although it works, I would still like to know how I could just do it in the appropriate theme template files or the `functions.php` file.


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

    May 28, 2013 at 2:47 pm #42953
    Chris Moore
    Member

    The `return '';` should actually contain the standard Facebook "Like" `div` code, from here: Link to Facebook Developers Page

    It gets stripped on the site here. (Anyone know how to avoid that?)


    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