• Resolved radiocono

    (@radiocono)


    I have a problem with this loop. I think it’s not closed on the line number 13
    one of you knows how to close it properly?

    <?php if ( in_category('CATEGORY NAME') ) {
    echo"HTML CODE";{ ?>
    <?php if (get_post_meta($post->ID, 'KEY', true) ) { ?>
    
    <!-- html code -->
    
    <?php } else { ?>
    
    <!-- html code -->
    
    <?php }     
    
    elseif ( in_category('CATEGORY NAME 2') ) {
    
    } else {
    
    }
    ?>
Viewing 7 replies - 1 through 7 (of 7 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    What is the error you’re getting and which line is it referring to?

    I believe this is it –

    <?php if ( in_category(‘CATEGORY NAME’) ) {
    echo”HTML CODE”;{ <—- notice you are opening another curly bracket, before closing the previous one ?>
    <?php if (get_post_meta($post->ID, ‘KEY’, true) ) { ?>

    Correct variation might be

    <?php if ( in_category('CATEGORY NAME') ) { ?>
    <?php echo"HTML CODE"; ?>
    <?php } elseif (get_post_meta($post->ID, 'KEY', true) ) { ?>
    
    <!-- html code -->
    
    <?php } elseif (some conditional) { ?>
    
    <!-- html code -->
    
    <?php } elseif ( in_category('CATEGORY NAME 2') ) {    
    
    <!-- html code -->
    
    } else {
    <!-- html code -->
    }
    ?>

    Thread Starter radiocono

    (@radiocono)

    on the editor tex code it said line 13 error
    where the code says:
    elseif ( in_category(‘CATEGORY NAME 2’) ) {

    } else {

    }
    ?>

    Thread Starter radiocono

    (@radiocono)

    now i try the loop by Evan Herman

    Thread Starter radiocono

    (@radiocono)

    what is necessary to add in (some conditional)?
    maybe
    (get_post_meta($post->ID, 'KEY', true) )

    Thread Starter radiocono

    (@radiocono)

    sorry
    (get_post_meta($post->ID, ‘KEY’, false) )

    Thread Starter radiocono

    (@radiocono)

    Evan Herman
    thank you very much

Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘if is in a category show this else dysplay other’ is closed to new replies.