Skip to content

How to Add Social Sharing Buttons to a List of WordPress Posts on an Index Page or category page with No Plugins

Facebook Like Buttons for WordPress Loops

  1. Go to the official Facebook page for creating buttons.
  2. For the URL to Like field, just enter in your website’s main URL for now, something like You can set any of the other settings as you’d like.
  3. Click Get the Code and choose IFRAME as the type of code you want to use.
  4. Copy and paste the providing code into your theme where you want the button to appear.
  5. Before saving, look through the code for the text “”, as highlighted in the example below:
    <iframe src="//" scrolling="no" frameborder="0" style="border:none; overflow:hidden; width:450px; height:80px;" allowTransparency="true"></iframe>
  6. Replace that entire highlighted section with <?php the_permalink(); ?>

And tooty fruity oh rudy you’re all set for Facebook. What we did there was used WordPress’ the_permalink() function to set the URL instead of the one Facebook asks us to manually enter.


Full article:


Published inWordpress