Add Facebook Like Shortcode to Post Meta Section of single blog post

pending (15 posts) (3 voices)

  1. wenmiester
    Member

    I'd like to add the facebook shortcode to the end of the post meta section (between the title of a blog post and the content, where it lists date, author, category, etc.). I want to embed it in the code so that I don't have to add it to every blog post manually. Which PHP file would I insert the shortcode in?

    Here's the shortcode I would use: [fblike layout="standard" show_faces="true" action="recommend" colorscheme="light"]

    thanks!

    Posted 10 months ago #
  2. Elliott
    Support

    Hello wenmiester,

    This sounds like a good idea for a tutorial. I'm gonna try and get something written here soon. I'll update this thread when it is finished.

    Posted 10 months ago #
  3. wenmiester
    Member

    sounds good, looking forward to reading it.

    Posted 10 months ago #
  4. Elliott
    Support

    Try this wenmiester, http://mysitemyway.com/docs/index.php/Using_Child_Themes#Types_of_PHP_customization

    I kind of rambled on a bit. I'll probably end up splitting it up into multiple articles and adding some images later.

    Let me know how it works for you.

    Posted 10 months ago #
  5. wenmiester
    Member

    thanks Elliot, this is really close to what I'm looking for. I also forgot to mention that I'm using the InFocus 2.0 theme. What I'm specifically looking for is the code that will put the facebook button directly to the right of the "category" data in the post_meta section, so that when rendered on a single blog post page, all of the post meta info will sit directly to the left of the facebook button.

    the code you provided in the tutorial nicely inserts the facebook like button directly beneath the featured image, but I would like for it to appear to the right of the category data (in between the two dividers that "house" all of the post metadata).

    Hopefully that makes sense.

    thanks for your help!

    Posted 10 months ago #
  6. Elliott
    Support

    Try adding these lines in Dashboard -> Modular -> General Settings -> Custom CSS,

    .post_meta { float: left; }
    div.mysite_sociable { width: 200px; margin-left: 10px; }
    Posted 10 months ago #
  7. wenmiester
    Member

    it looks like that didn't work. I imagine that it will be more along the lines of inserting the facebook shortcode into the php generation of the actual post meta data, instead of tweaking the CSS. I basically just need the facebook button to always be the last thing to appear in the post meta data section. Tweaking the CSS with your recommendations moved the facebook button a little closer to the meta data section, but still didn't put it within it. So I think I just need to know where to insert the shortcode in whatever php file that generates the meta data. I hope this makes sense.

    thanks for the help!

    Posted 10 months ago #
  8. wenmiester
    Member

    Elliot, it looks like my client doesn't need the facebook button in the meta data section, so don't worry about trying to fix this. thanks for your help!

    Posted 10 months ago #
  9. Elliott
    Support

    It could have been that your meta section was a little bit wider than mine. In that case you would have reduced the 200px to something like 100px so it would fit on one line.

    Let us know if you have any other questions wenmiester.

    Posted 10 months ago #
  10. Hello, Elliott!

    I've tried to add [facebook] shortcode as you proposed here http://mysitemyway.com/docs/index.php/Using_Child_Themes#Redeclaring_functions - by adding this code to 'functions.php' file (inFocus on my site http://greyarium.com/blog/):

    <?php
    add_action('mysite_singular-post_before_entry', 'my_custom_function', 100);
    function my_custom_function()
    {
    	echo do_shortcode('[fblike layout = "standard"]');
    	echo do_shortcode('[clearboth]');
    }
    ?>

    The result: It worked, but it removed my theme page backgrounds and changed the color of all the links and hovers to blue (somehow it breaks the theme). Is there an issue to make it work without breaking the theme?

    Thanks again for those great explanations on custom mysitemyway-coding!

    Posted 7 months ago #
  11. Elliott
    Support

    Hello Greya,

    That code is for a child theme. If your not using one then you would place it in the bottom of the /wp-content/themes/[your_theme]/framework.php file instead.

    Posted 7 months ago #
  12. That's exactly what I did then - the result was the same((

    Posted 7 months ago #
  13. Elliott
    Support

    Send us a link to your page and let us know where your wanting the button to display.

    Posted 7 months ago #
  14. I'll try to work it out with a plugin not to bother you so much again.
    I'll come back to you if I have problems with it..
    Thanks for quick replies!

    PS: I want it to look like in this screenshot (under the post)
    http://wordpress.org/extend/plugins/wordpress-social-ring/screenshots/
    Just didn't want to add another plugin if this functionality is already implemented in the theme.
    But if you have some time, I'll be glad to take your advice :)

    Posted 7 months ago #
  15. Elliott
    Support

    I think that code should be working for you then. Send us a private message with a link to your site as well as a Wordpress and FTP login and we'll take a look at your file.

    Posted 7 months ago #

Reply

You must log in to post.

Construct WordPress Theme
Construct wordpress theme
Myriad WordPress Theme
Myriad wordpress theme
Method WordPress Theme
Method wordpress theme
Fusion WordPress Theme
Fusion wordpress theme
Elegance WordPress Theme
Elegance wordpress theme
Echelon WordPress Theme
Echelon wordpress theme
Dejavu WordPress Theme
Dejavu wordpress theme
Modular WordPress Theme
Modular wordpress theme