• I want to have a different hover link colour for different posts, and am thinking of using the custom field to specify hover link colour to be used in the <head> section.

    I’ve looked through plugins for meta in the codex, and am using Get Custom Field Values but posts don’t display the correct custom field i.e. it uses another post’s custom field value for the colour.

    Anyone can help on this? Is there another way to have different hover link colour for different posts?

Viewing 3 replies - 1 through 3 (of 3 total)
  • You’re defining the color as a custom field in each post? Interesting use of meta content. Here’s a bit of code that pulls up the ‘color’ custom field value:

    <?php
    the_post();
    if(get_post_custom_values('color')) {
    foreach(get_post_custom_values('color') as $color) {
    }
    }
    rewind_posts();
    ?>

    Then add the following where you need to display the value (in $color):

    <?php echo $color ?>

    Thread Starter tyh

    (@tyh)

    Thanks! Works perfectly.

    alun

    (@alun)

    I’d like to add my thanks too. I now have a custom field which allows me to use a special stylesheet for wide posts (like https://archaeoastronomy.co.uk/?p=528) but keep the sidebar for ordinary posts (like https://archaeoastronomy.co.uk/?p=585).

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Using meta in header’ is closed to new replies.