get_pages bring in custom meta values
-
Hi all, in a bit of a pickle.
I am currently using a piece of code that is working as it should to bring in all of the content of each page in to one page. However, in order to make it as easy as possible for the client I have set up some meta boxes in each page for them to add the relevant information. My problem is I can’t seem to figure out a way to bring that information through for each individual page.
If i enter something in the home page (which is where everything is being brought in to) then it shows on every page. I’ve tried a few bits and bobs with no success.
Below is my code, any help is much appreciated.
Thanks
Dan<?php $args = array( 'sort_column' => 'menu_order', ); $pages = get_pages($args); foreach ($pages as $page_data) { $content = apply_filters('the_content', $page_data->post_content); $title = $page_data->post_title; echo '<li data-menu_item="'.$page_data->post_name.'">'; echo '<h2><span>'.$title.'</a></h2>'; echo '<div class="content">'.$content.'<p><a class="close" title="close"></a></p></div>'; $meta = get_post_meta( get_the_ID(), 'the_text', true ); echo $meta; // If you want to show echo '</li>'; } ?>
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘get_pages bring in custom meta values’ is closed to new replies.