help with custom field data
-
hello, hope someone here can help me.
i would like to do two things, and both require ‘getting’ information from a page / its custom field data, and inserting into another code.
first: in my category.php file, before calling up all posts from a specific category, i’d like to insert code that would call up the content from a page with the same name as the category name.
for example, for a category named ‘The Beatles’ i’d like to pull up the_content from a page also named ‘The Beatles’ and include it in the category
if i could get this to work, this second part won’t be as important, however i’d still like to know how to do it…
second, on a page i’d like to call up all posts from a specific category. the category id would be specified as a value from a custom field entry from that page.
i’ve used get_posts to pull up the posts, and get_post_meta to pull up the custom field data, however when i use them together like this, it gives me an error:
<?php $postslist = get_posts('numberposts=5&order=DESC&orderby=ID&category=<?php echo get_post_meta($post->ID, 'identity', true); ?>'); foreach ($postslist as $post) : setup_postdata($post); ?> <div class="recent"> <?php the_excerpt(); ?> <a href="<?php the_permalink(); ?>"><?php the_title(); ?></a> </div> <?php endforeach; ?>
kind of new to more ‘complex’ use of this code so any help is greatly appreciated!
- The topic ‘help with custom field data’ is closed to new replies.