Support » Plugin: Custom Post Types and Custom Fields creator - WCK » Fields doesn’t show on main site

  • Resolved ascenda

    (@ascenda)


    Hello.

    I tried to set the PHP entry as recommended, but despite the “copy paste” execution doesn’t work.

    I’m using “PHP Everywhere” plugin; I don’t paste this to post file.php:

    <?php $books = get_post_meta( $post->ID, 'books', true ); 
    foreach( $books as $book){
        echo $book['book-name'] . '<br/>';
        echo $book['author-name'] . '<br/>';
    }?>

    When I go to the main site, I see:
    Warning: Invalid argument supplied for foreach() in /home/[my hosting path]/public_html/wp-content/plugins/php-everywhere/shortcode.php(15) : eval()'d code on line 4

    Line 4 is:
    foreach( $books as $book){

    I tried if (is_array($book) || is_object($book)):

    $books = get_post_meta( $post->ID, 'licznikowniawck', true ); 
    if (is_array($book) || is_object($book))
    {
    	foreach( $books as $book){

    …but fields doesn’t show up.
    I ran out of ideas… 🙁

    • This topic was modified 6 months, 3 weeks ago by ascenda.
    • This topic was modified 6 months, 3 weeks ago by ascenda.
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Fields doesn’t show on main site’ is closed to new replies.