Support » Fixing WordPress » Display Title of Post Depending on Time of Day

  • Hi There,

    I’m currently working on a WordPress website for a radio station.

    The lineup for each day is broken up into daily categories as children (“monday”, “tuesday” etc etc) of “lineup”

    Each post with in the category has two custom fields, a Start time “timestart” and an end time “timeend” all the posts have been entered using 24 Hour time. Example below

    timestart: 07:00
    timeend: 09:00

    etc etc

    Now what i want to do is have a global section in the header of my website that displays the current show which is on air depending on the time of the day.

    Does anybody have any ideas on how i can achieve this.

    Any help would be awesome

    Kind Regards
    – Solly

Viewing 4 replies - 16 through 19 (of 19 total)
  • Any body got any ideas for this post ?

    I have a page called lineup.php which consists of a 7 scrolling panels (one for each day) below is my code for Monday, and each day is repeated this but obviously for each days category. There is also a Monday to sunday navigation at the top of the page where users can click on a day and it will take them to that panel.

    <div class=”panel” id=”monday”>
    <div class=”postCopy” style=”font-size:13px; line-height:1.8em;”>
    <h3 class=”day”>Monday</h3>

      <?php $my_query = new WP_Query(‘category_name=monday&showposts=15&order=ASC’);
      while ($my_query->have_posts()) : $my_query->the_post();
      $do_not_duplicate = $post->ID;?>

      $timestart = get_post_meta($post->ID, ‘timestart’, true);
      $timeend = get_post_meta($post->ID, ‘timeend’, true);
      $genre = get_post_meta($post->ID, ‘genre’, true);
      $permalink = get_permalink();

    • <p class=”lineupTime”><?php echo $timestart; ?> – <?php echo $timeend; ?></p> <span class=”showName”>” rel=”bookmark” title=”<?php the_title_attribute(); ?>”><?php the_title(); ?> – (<?php echo $genre; ?>)</span>
    • <?php wp_link_pages(array(‘before’ => ‘<p>Pages: ‘, ‘after’ => ‘</p>’, ‘next_or_number’ => ‘number’)); ?>

      <?php endwhile; ?>

      <?php if (have_posts()) : while (have_posts()) : the_post();
      if( $post->ID == $do_not_duplicate ) continue; update_post_caches($posts); ?>

      <?php endwhile; endif; ?>
      <?php echo $category->category_description; ?>



    My first question is:

    The $timeend custom field which i’ve had to set to 05:59,08:59 etc etc so it rolls over smoothley for each show looks a bit messy when echoed on the page. I was wondering if its possible to echo the timeend custom field but somehow make it display so instead of it being 05:59, it would be 06:00 – With out going into the custom fields and changing them to that?

    My Second question is:

    With each of those panels displaying, How can i make it so that when someone clicks on the lineup page the first panel which is displayed is the current day, rather than it always being Monday.

    Any help would be greatly appreciated.


    any ideas ;o sorry for bumping

    I know its related but is this a different question, issue? You fixed the original question already right?

    In that case I would make a new post and don’t forget to use the CODE button =]. And reference this post in the new one if you need to.

Viewing 4 replies - 16 through 19 (of 19 total)
  • The topic ‘Display Title of Post Depending on Time of Day’ is closed to new replies.