WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Reposting posts specific to days of week? (10 posts)

  1. melbari
    Member
    Posted 1 year ago #

    Is there a plugin or hack that will allow me to schedule a specific post on a specific day of the week? For example, Post1 to be shown every Monday, Post2 to be shown every Tuesday, Post3 to be shown every Wednesday etc.

  2. IMICreation
    Member
    Posted 1 year ago #

    you can try like this

    <?php if(have_posts()):while(have_posts()):the_post(); $post=get_the_title(); $today=date('l'); if(($today=='Friday')&&($post=='Post1')||($today=='Saturday')&&($post=='Post2')||($today=='Sunday')&&($post=='Post3')||($today=='Monday')&&($post=='Post4')){ your post title or content or thumbnail whichever you want to show }?>

  3. melbari
    Member
    Posted 1 year ago #

    I'm using a PHP Code plugin so my widget can support and execute PHP snippets. I tried entering the code below but the code is not executing. I'm not a coder so I'm just guessing at what to manipulate. What am I missing? I have created separate posts for each day of the week. Thank you for your help!

    <?php if(have_posts()):while(have_posts()):the_post(); $post=get_the_title(); $today=date('l'); if(($today=='Monday')&&($post=='Monday Drink Specials')||($today=='Tuesday')&&($post=='Tuesday Drink Specials')||($today=='Wednesday')&&($post=='Wednesday Drink Specials')||($today=='Thursday')&&($post=='Thursday Drink Specials')||($today=='Friday')&&($post=='Friday Drink Specials')||($today=='Saturday')&&($post=='Saturday Drink Specials')||($today=='Sunday')&&($post=='Sunday Drink Specials')){ your post title or content or thumbnail whichever you want to show }?>

  4. IMICreation
    Member
    Posted 1 year ago #

    try this line <?php echo $post; ?> instead of this "your post title or content or thumbnail whichever you want to show"

  5. melbari
    Member
    Posted 1 year ago #

    Hmm... I don't think the php is executing from the php-allowable widget.
    I even tried a widget with simply <?php $date = date(“format”, $timestamp); ?>

  6. Andrew Nevins
    Barrel Rider, Spam Zapper & Volunteer Moderator
    Posted 1 year ago #

    You're assigning a variable, not executing it.
    Did you try Nitin_8's example on his/her second post?

  7. melbari
    Member
    Posted 1 year ago #

    I tried:

    <?php if(have_posts()):while(have_posts()):the_post(); $post=get_the_title(); $today=date('l'); if(($today=='Monday')&&($post=='Monday Drink Specials')||($today=='Tuesday')&&($post=='Tuesday Drink Specials')||($today=='Wednesday')&&($post=='Wednesday Drink Specials')||($today=='Thursday')&&($post=='Thursday Drink Specials')||($today=='Friday')&&($post=='Friday Drink Specials')||($today=='Saturday')&&($post=='Saturday Drink Specials')||($today=='Sunday')&&($post=='Sunday Drink Specials')){ <?php echo $post; ?> }?>

  8. IMICreation
    Member
    Posted 1 year ago #

    please post you whole template code through pastebin
    in the above code there is php mistakes

  9. Andrew Nevins
    Barrel Rider, Spam Zapper & Volunteer Moderator
    Posted 1 year ago #

    I think that code Nitin_8 recommended in his/her first post was for exampled purpose.

    Your code should have an "Unexpected End" error.
    Let us know what amount of knowledge you have with PHP.

  10. melbari
    Member
    Posted 1 year ago #

    Ahh... it's a conflict with my "Enhanced Text" widget and "Dynamic Widget" plugin. Only the title of the text widget and not the content is showing. I'm closing the ticket. Thanks for the help!

Topic Closed

This topic has been closed to new replies.

About this Topic