• Love your plugin. I’m trying to call a post_meta in the table and am having no luck. I’m sure it’s a simple coding thing, but I’m not getting it. Below is the php script I’m trying to call. Thank you!

    <?php if ( get_post_meta($post->ID, 'holes', true) ) { ?>
    <p style ="text-align:center;"><?php echo get_post_meta($post->ID, "holes", $single = true); ?></p>
    <?php } ?>
Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi,

    have you installed the “PHP in table cells” Extension from the plugin website: https://tobias.baethge.com/2010/02/extension-5-how-to-use-php-in-table-cells/?

    If yes, what error messages to you get or what is not working?

    Regards,
    Tobias

    Thread Starter jkyoung08

    (@jkyoung08)

    I hadn’t, but now that I have – I get the following error:

    Parse error: syntax error, unexpected $end in /nfs/c07/h02/mnt/101995/domains/siod-demo.com/html/jgolf/wp-content/plugins/wp-table-reloaded-extensions.php(17) : eval()’d code on line 1

    Thanks

    Thread Starter jkyoung08

    (@jkyoung08)

    Actually, it doesn’t return anything. I had a error when I pasted the code into the cell that resulted in that error. The php code is correct, I tried just pasting it into the content area and returned the correct number.

    Hi,

    ok, so you are now not getting an error message anymore, but your PHP code is still not working? Is that what you mean?

    After taking a look at your code, you might need to insert a

    global $post;

    before the if-conditional, because as the PHP is executed from inside a function, the variable does not exist otherwise.

    Best wishes,
    Tobias

    Thread Starter jkyoung08

    (@jkyoung08)

    Sorry. I’m a php rookie ??

    I took out the if-conditional, because I really don’t need it anyway, there will always be the field I’m calling in the posts I insert the table short code.

    Entering this code doesn’t return anything when I open the post:

    <p style ="text-align:center;"><?php echo get_post_meta($post->ID, "holes", $single = true); ?></p>

    Here is the post I’m attempting to use: https://siod-demo.com/jgolf/locust-hills-golf-course, and here is a screenshot of how I entered the code in the table backend https://awesomescreenshot.com/0266i4743

    I appreciate the help. I will definitely be donating to the Tobias-fund when we get this figured out..

    Hi,

    ok, thanks for the clarification.

    Can you please try with the following code?

    <p style="text-align:center;"><?php echo get_post_meta( get_the_ID(), "holes", true); ?></p>

    That should do what you want.

    The idea of a Tobias-fund sounds definitely nice, but I guess there’s not enough money for that yet ??

    Best wishes,
    Tobias

    Thread Starter jkyoung08

    (@jkyoung08)

    Works! Bless you. Thanks so much!

    Hi,

    great to hear that! You are very welcome!

    Best wishes,
    Tobias

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘[Plugin: WP-Table Reloaded] Trying to call php script in cell’ is closed to new replies.