Forums

  • # July 11, 2013 at 2:22 am

    I am on the last step in a tutorial that I followed [here](http://wp.tutsplus.com/tutorials/reusable-custom-meta-boxes-part-4-using-the-data/ “http://wp.tutsplus.com/tutorials/reusable-custom-meta-boxes-part-4-using-the-data/”) , called “Using the data”.

    I tried using//

    < ?php $album_repeatable = unserialize($post_meta_data[0]);
    echo '[ul class="album_repeatable"]';
    foreach ($album_repeatable as $string) {
    echo '[li]'.$string.'[/li]';
    }
    echo '[/ul]';
    ?>

    But I get the Warning as stated in Discussion Title//

    “_Warning: Invalid argument supplied for foreach()_ “

    What exactly is the issue here, in terms I could understand? lol
    Please help me fix this?…

    # July 11, 2013 at 3:46 am

    **SOLUTION**//
    Used normal method to get field data instead of “_unserialize_”

    Switched this line:

    $album_repeatable = unserialize($post_meta_data[0]);

    to this line:

    $album_repeatable = get_post_meta($post->ID, 'album_repeatable', true);

    Now my repeatable field Data is being displayed.

    # July 11, 2013 at 4:05 pm

    @traq I appreciate you trying to explain, just wish I understood it lol!
    But yeah…thank you :)

    # July 14, 2013 at 3:55 am

    @traq I was just following the tutorial, that’s all. hehe :)

Viewing 4 posts - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.

icon-anchoricon-closeicon-emailicon-linkicon-logo-staricon-menuicon-nav-guideicon-searchicon-staricon-tag