Support » Fixing WordPress » Carrying variable from multiple post to single post page

  • Hi,
    My index page switches between three styles for each post using this:

    <?php $oddpost = 'post-style-1';  ?>
    
    <div class="<?php echo $oddpost; ?>" id="post-<?php the_ID(); ?>"> 
    
    <?php if ('post-style-1' == $oddpost) $oddpost = 'post-style-2';
     elseif ('post-style-2' == $oddpost) $oddpost = 'post-style-3';
    		else $oddpost = 'post-style-1';  ?>

    I use this (among other things) to have a different coloured heading for each post on the index page.

    When I click through to the single post page I want to have the same coloured header.

    For example, if the post I read on the index page has a blue header, I’d like the single post page to also have a blue header. And if the post on the index page has a red header, I’d like the single post page to also have a red header.

    Any ideas?

    Many thanks!

  • The topic ‘Carrying variable from multiple post to single post page’ is closed to new replies.