• Resolved miss-d

    (@miss-d)


    Hi,

    I’m fiddling around with this but it won’t word ??
    I’m having an advent calendar and want to show today (on 1st of December) a published post – all other 24 posts till Christmas are set to future status.

    Now I want to show a message for any user who clicks on the 24th saying “Please be patient until this date”

    Can anyone help me what to put in single.php to show correct?

    Many many thanks!!!

Viewing 8 replies - 1 through 8 (of 8 total)
  • yehudah

    (@yehudah)

    hey

    is that a plugin ?

    any example ?

    Thread Starter miss-d

    (@miss-d)

    No, no plugin, I’m trying to do this on my own, and I’m still a beginner, so bare with me…

    <?php if ($post_status = "future"): ?>
         <p style="font-family: Arial; font-size: 14px;">Please be patient until this date :)</p>
           <?php else: ?> 
    
         <?php while (have_posts()) : the_post(); ?>
    	<?php echo '<h2 style="font-family: Arial; font-size: 14px; color: #b22222;">';
    	the_title();
    	echo '</h2>';
    	echo '<p>';
    	the_content();
    	echo '</p>';
    endwhile;
    ?>
    
    <?php endif; ?>

    …this is not working :\ but I’m a real greenhorn with this all.

    Thanks for any help!!

    yehudah

    (@yehudah)

    first it’s bad to update wordpress core files everything to be done
    with a plugin

    second what does that mean:”clicks on the 24th” press where ? in the calander widget ?

    Thread Starter miss-d

    (@miss-d)

    Unfortunately there is no plugin that does that for me … it’s an advent calendar using a image rollover map and the plugin “Easy Fancybox” to display the popups in a lightbox windows (one rollover for each day in December… that’s a German thing ??

    Now I need an if/condition that tells wordpress “if you rollover on #24 and it’s still the 1st od december please give out a msg that you gotta wait till then – you should be able to only open the numbers of current or past dates (I have set all other 23 posts except today to status future)

    Thanks yehudah so far for trying to help ??

    Moderator keesiemeijer

    (@keesiemeijer)

    On single.php you can test if a post_status is “future” with this:

    <?php
    if($post->post_status == 'future') : ?>
    <!-- do stuff -->
    <?php else : ?>
    <!-- do stuff -->
    <?php endif; ?>

    yehudah

    (@yehudah)

    no problem

    i’m sorry but when i help i try to understand the concept but you
    lost me.

    can you post a link to what you done so far.

    Thread Starter miss-d

    (@miss-d)

    keesiemeijer you saved my day thanks a lot!!! ?? – it’s working now (at least in Firefox, IE is not giving out the future post msg): See here:

    https://www.lebensberatung-ce.eu/adventskalender-2011

    This is my code:

    <?php
    while ( have_posts() ) : the_post(); ?>
    
    <?php
    if($post->post_status == 'future') : ?>
    <?php echo ' <p style="font-family: Arial; font-size: 14px;">Bitte noch ein wenig Geduld f&uuml;r dieses T&uuml;rchen :)</p>' ?>
    <?php else : ?>
    <?php the_title(); ?>
    <?php the_content(); ?>
    <?php endif; ?>
    <?php endwhile; ?>

    Thank you guys ??

    yehudah

    (@yehudah)

    very nice

    glad it worked.

Viewing 8 replies - 1 through 8 (of 8 total)
  • The topic ‘Help with conditional for future posts’ is closed to new replies.