Custom field global query
-
On a post in WP, I have 3 custom fields say for example, with corresponding name and value.
1. Africa – 10 Staff
2. Australia – 20 Staff
3. Asia – 30 StaffThis will appear on post as-is. The post will have 3 tags namely Africa, Australia and Asia.
Now, when I clicked on tag Asia, it will query the value only for Asia. Same goes when I view the page tagged as Africa, it will display value for Africa.
I am doing this to avoid duplicate content for tag pages. Also to serve tag page as summary info.
To sum it up. I created a tag.php and wanted to display this info for every tag pages.
“In Asia we have approximately 30 Staff blah blah…”
I managed to pull out just one with the following code
In <?php single_tag_title(); ?> we have approximately <?php global $wp_query; $postid = $wp_query->post->ID; echo get_post_meta($postid, 'asia', true); ?> blah blah.Need your help…
Calling Nate once more…
The topic ‘Custom field global query’ is closed to new replies.