Archive page uses post meta from first post
-
I have a custom heading for each of my posts that can be update from the admin area of each post. Strangely though WordPress seems to ignore this for custom post archive pages and uses the post meta data from the first post on the archive. Is there a way around this?
Just for some context I have this code at the top of my header.php
<?php $config = (object)get_post_meta(get_the_id(), 'sc_page_settings', true ); ?> <body class="<?php echo $config->color ? $config->color : '' ; ?>">
Ideally if I select the color blue from the admin area this will be stored in the database and will be echoed as the body class.
However it is not doing this on archive pages. To update the archive page header I have to make changes to the latest post, which is a bit of a faff.
Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
- The topic ‘Archive page uses post meta from first post’ is closed to new replies.