treehouse : what would you like to learn today?
Web Design Web Development iOS Development

Display content from another page with custom fields in Wordpress

  • So, I am trying to hack my way through this and I almost have a solution, but I feel that I am either missing some steps or going about it the wrong way. Either way here's what I am trying to do.

    In Wordpress, I am trying to get content from certain pages that are using custom fields to insert editable blocks of content (MultiEdit Plugin). I have one page setup to call back these pages using the query_post function.
    I have it setup to filter out the pages by a custom field which works, but it's not pulling the other custom fields into the content area.

    Here's my code:

    <?php 

    $args = array(
    'post_type' => 'page',
    'meta_value' => 'inventory'
    );
    query_posts( $args ); ?>



    So, from my understanding the above pulls the content from the pages that have the custom field of inventory. But is there something else that I need to include so that it pulls the other content that is in the other custom fields within those pages?

    Any help is greatly appreciated. Thanks!
  • I think what you are looking for is.
    <?php echo get_post_meta($post->ID, 'name_of_custom_meta', true); ?>

    This will output the saved info in the custom meta box.

    Check the WordPess Codex for get_post_meta() for more details.