HOw to create a unquie Header on every post
-
I found the following from a post 6 years ago.
<?php if(is_single() & !is_home()) { $myfield = 'custom_field_name'; // Change this to the name of the custom field you use.. $postimage = get_post_meta($post->ID, $myfield, true); ?> <style type="text/css"> <!-- .yourheaderclass { border:none; color:black; <?php if($postimage) { // If the field has a value.. set background image using value... ?> background-image: url('some/path/to/image/<?php echo $postimage; ?>.jpg'); <?php } elseif(!$postimage) { // If no value ?> background-image: none; <?php } ?> } --> </style> <?php } ?>
I do not have ‘custom_field_name’ and am unsure if the php is still usable. Can anyone confirm if this still works or have a solution for 4.4.2.
Regards,
Matt
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
- The topic ‘HOw to create a unquie Header on every post’ is closed to new replies.