WordPress.org

Ready to get started?Download WordPress

Forums

How to properly explode string in wp - Custom Write Panel (1 post)

  1. krazymatty
    Member
    Posted 2 years ago #

    I'm trying to build a custom write panel using custom fields and I'm stuck. I want put in a string of post id's into one field separated by commas. Example: 1,5,2

    My issue I can't seem to properly pull the meta back to use in the theme.

    Here is my code and I'm not sure if it's remotely right.

    I'm using it in the loop as well.

    <?php
    
      $mykey_values = get_post_custom_values('tabs');
      foreach ( $mykey_values as $key => $value ) {
        echo "$key  => $value ('my_key')<br />";
      }
    
    ?>

    Here is the result: 0 => a:1:{s:4:"tabs";s:5:"1,5,2";} ('my_key')

    I was hoping it would look like this:
    1
    5
    2

    Thanks,

    Phil

Topic Closed

This topic has been closed to new replies.

About this Topic