Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #647925

    HI,
    in my child theme’s single.php I have modified this code:

                            get_template_part( 'includes/loop', 'index' );
    

    to:

    if(in_category('current-developments')) {
                            get_template_part( 'includes/loop', 'index' );
    				}
    				
    				 else  {
                            get_template_part( 'includes/loop', 'sub-index' );
    				}

    This is working fine, I am able to customise the loop for those in the category ‘current-developments’. My issue is I cant figure out how to add multiple categories here, I tried:

    if(in_category('current-developments','other-category')) {
                            get_template_part( 'includes/loop', 'index' );
    				}
    				
    				 else  {
                            get_template_part( 'includes/loop', 'sub-index' );
    				}

    but this didnt work.

    Any help would be great!

    thanks

    #649458

    Hey dannhanks,

    You need to pass an array as parameter:

    if(in_category(array('current-developments','other-category'))) {
    

    Best regards,
    Josue

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.