Try this
Put this before the loop:
<?php
$mydate = date("l");
if($mydate == 'Monday') { $pageid= 1;}
if($mydate == 'Tuesday') { $pageid= 2;}
if($mydate == 'Wednesday') { $pageid= 3;}
// etc etc
query_posts('page_id='.$pageid);
?>
Thread Starter
r1987
(@r1987)
Thanks!
It seems to work actually, but after that I have small problems with the layout.
I have 4 divs on the front page: NEWS, DAILY SPECIAL, CONTENT, LINKS.
After putting the php code to DAILY SPECIAL div it opens the queried page in the content div, not in the daily special. And when clicking on the links the content won’t change.
What seems to be the problem?
Please provide a link to the page in question. without it there’s not much anyone can do to help.
What seems to be the problem?
it might need a wp_reset_query();
at the end of the DAILY SPECIAL area, to reset the query string to ‘normal’ after the custom query.
Thread Starter
r1987
(@r1987)
Sorry, can’t show it online yet, because I don’t have the host for this page yet.
Anyhow, I can paste the code here as well:
I have the index.php, with 4 divs:
<?php get_header(); ?>
<!-- GATHERING DIV END -->
<div class="grid_3" id="gathering">
<h2>Gathering</h2>
<br/>
…
</div>
<!-- GATHERING DIV END -->
<!-- DAILY SPECIAL DIV START -->
<div class="grid_3" id="dailyspecial">
<?php
$mydate = date("l");
if($mydate == 'Monday') { $pageid= 6;}
if($mydate == 'Tuesday') { $pageid= 2;}
if($mydate == 'Wednesday') { $pageid= 39;}
query_posts('page_id='.$pageid);
?>
</div>
<!-- DAILY SPECIAL DIV END -->
<!-- CONTENT DIV START -->
<div class="grid_4" id="content">
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<div class="post" id="post-<?php the_ID(); ?>">
<h2 class="title"><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title(); ?>">
<?php the_title(); ?>
</a></h2>
<div class="entry">
<?php the_content('',TRUE,''); ?>
</div>
</div>
<?php endwhile; ?>
<div class="navigation">
<div class="alignleft">
<?php next_posts_link('« Older posts') ?>
</div>
<div class="alignright">
<?php previous_posts_link('Newer posts »') ?>
</div>
</div>
<?php else : ?>
<h2 class="center">No posts found.</h2>
<?php endif; ?>
</div>
</div>
<!-- CONTENT DIV END -->
<?php get_sidebar(); ?>
<?php get_footer(); ?>
+ sidebar.php where i have the nav.
I’d like to show the Daily Special and the content on the front page, but it seems to me that the query_posts(); has somekind of a conflict, because the called out page in Daily Special appears in the content div, not where I’d like to see it (dailyspecial div). + the navbar gets paralyzed.
To alchymyth:
wp_reset_query(); helped that much that the dailyspecial didn’t appear in the content div, but didn’t appear in dailyspecial to.
So.. any ideas ?
Thread Starter
r1987
(@r1987)
Alright!
Think that got it to work.
Here’s the code, that goes to the DAILY SPECIAL div:
<?php
$mydate = date("l");
if($mydate == 'Monday') { $pageid= 6;}
if($mydate == 'Tuesday') { $pageid= /*page_id*/;}
if($mydate == 'Wednesday') { $pageid= /*page_id*/;}
if($mydate == 'Thursday') { $pageid= /*page_id*/;}
if($mydate == 'Friday') { $pageid= /*page_id*/;}
if($mydate == 'Saturday') { $pageid= /*page_id*/;}
if($mydate == 'Sunday') { $pageid= /*page_id*/;}
?>
<?php
$featured = new WP_Query();
$featured->query('page_id='.$pageid);
?>
<?php while ($featured->have_posts()) : $featured->the_post(); ?>
<?php the_content(); ?>
<?php endwhile; ?>
I’m building a ‘daily special’ plugin for exactly this purpose. Should be ready soon. I’ll post back with a link once I do.
!cheers!