Child page custom field overriding partent custom fields
-
Client wants to style each page of his site differently. Using this to display two custom fields.
<?php $mymeta = get_post_meta($post->ID, 'background_image', true); if ($mymeta) {echo '<style type="text/css" media="screen">.background {background-image: url('.$mymeta.') !important;'; } ?> <?php $mymeta = get_post_meta($post->ID, 'background_color', true); if ($mymeta) {echo 'background-color: #'.$mymeta.' !important;} </style>'; } ?>
Problem is that I created a main page that displays child pages and on the main page, I think the first child custom fields are overriding the parent page’s custom fields.
Parent Page: https://sugareffect.com/dev/works/
1st Child Page: https://sugareffect.com/dev/works/sugar-effect-into-sequence/Is there a way to display the custom fields for the current page only while ignoring the custom fields from the child pages?
Viewing 4 replies - 1 through 4 (of 4 total)
Viewing 4 replies - 1 through 4 (of 4 total)
- The topic ‘Child page custom field overriding partent custom fields’ is closed to new replies.