Support » Plugin: Bottom of every post » Get error trying to use PHP in .txt file

  • Resolved xiabolai



    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="<?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?


Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Corey Salzano



    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.


    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!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Get error trying to use PHP in .txt file’ is closed to new replies.