• Resolved mollerup

    (@mollerup)


    Hello,
    i’m trying to make a menu with each month, but i only want to have 6 months visible, current month and then 5 months, not all 12.
    i have been trying to do this with is_date and is_month, but i can’t seem to make it work.
    Is it even possible with this plugin?

    kind regards

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author shazdeh

    (@shazdeh)

    Hi!

    The is_month() function checks whether visitor is currently on a “monthly archive page” (where they see a list of all posts published in that month), not whether current date is a particular month. is_date() is similar as well.

    What you’re looking for can be accomplished using the PHP date function (docs: http://php.net/manual/en/function.date.php), for example to check for a particular month you can use the condition:

    
    "1" === date( 'n' )
    

    That checks if currently it’s January. You can change that according to your needs.

    Thread Starter mollerup

    (@mollerup)

    Thank you for this, helped me a lot !

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Conditional menu with is_date or is_month’ is closed to new replies.