WordPress.org

Ready to get started?Download WordPress

Forums

Show specific category on specific week day (2 posts)

  1. yollyflopp
    Member
    Posted 3 years ago #

    I'm working on a site that has 7 different users and we want to show each users category on each different day. So on monday I want to show only posts from category 1 on the index-page, on tuesday only posts from category 2 and so on. I've got basic knowlege of php-coding, but I don't get this to work. Can someone help me please!

  2. yollyflopp
    Member
    Posted 3 years ago #

    I solved it myself with just using this following code before the "have_posts"-coding

    <?php $today = date('N');
    if( $today == 1) : query_posts( 'cat=8' ); { ?>
    <?php } elseif( $today == 2 ) : query_posts( 'cat=5' ); { ?>
    <?php } elseif( $today == 3 ) : query_posts( 'cat=7' ); { ?>
    <?php } elseif( $today == 4 ) : query_posts( 'cat=9' ); { ?>
    <?php } elseif( $today == 5 ) : query_posts( 'cat=10' ); { ?>
    <?php } elseif( $today == 6 ) : query_posts( 'cat=6' ); { ?>
    <?php } elseif( $today == 7 ) : query_posts( 'cat=11' ); { ?>
    <?php } ?>
    
    <?php endif; ?>

Topic Closed

This topic has been closed to new replies.

About this Topic