Bottom of every post
[resolved] Get error trying to use PHP in .txt file (3 posts)

  1. xiabolai
    Posted 3 years ago #


    I'd love to use the plugin to place share buttons under each post, but it's not allowing some of the buttons with PHP to function. For example, the Pinterest button which uses this code:

    <a href="http://pinterest.com/pin/create/button/?url=<?php the_permalink(); ?>&media=<?php if(function_exists('the_post_thumbnail')) echo wp_get_attachment_url(get_post_thumbnail_id()); ?>&description=<?php echo get_the_title(); ?>" class="pin-it-button" count-layout="horizontal">Pin It</a>

    Any way I can modify the plugin to accept code like this?



  2. Corey Salzano
    Plugin Author

    Posted 3 years ago #


    Thanks for trying my plugin. You are correct, this plugin will not execute PHP stored in the text file.

    It looks like you are trying to put a "share on pinterest" widget at the bottom of each post. You could create a widget area on your theme, and use a pinterest widget instead of my plugin.

    Another idea is to get one of the plugins that allow PHP to be executed in pages and posts. I don't like this solution very much because it's a bit ugly and the plugins that accomplish this contain a PHP eval call.

    To directly answer your question, is there a way you can modify my plugin to execute PHP stored in the text file, probably. I don't recommend it, though, because you would be saving PHP code in a text file that would be loaded and executed by some other PHP. That's a bad design. The best solution would be to find or make a pinterest widget, and customize your theme to have widget areas near your posts in the spots where you would like the widget to appear.

    Thanks again.

  3. xiabolai
    Posted 3 years ago #


    Thank you very much for replying. I don't want to do something messy or risky so I will try another solution. Perhaps like you suggest a widget area below the content.

    Thanks again!

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Bottom of every post
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic


No tags yet.