• Resolved melbari

    (@melbari)


    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.

Viewing 9 replies - 1 through 9 (of 9 total)
  • 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 }?>

    Thread Starter melbari

    (@melbari)

    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 }?>

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

    Thread Starter melbari

    (@melbari)

    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); ?>

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

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

    Thread Starter melbari

    (@melbari)

    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; ?> }?>

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

    Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    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.

    Thread Starter melbari

    (@melbari)

    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!

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Reposting posts specific to days of week?’ is closed to new replies.