• Resolved ronimarin

    (@ronimarin)


    Can anyone tell me why this is not working?

    <?php if ( (is_front_page()) || (is_page(array(582))) || (is_paged() == 'false') ) { ?>
    <div>Something to include</div>
    <?php } ?>

    Thank you!

Viewing 10 replies - 1 through 10 (of 10 total)
  • Thread Starter ronimarin

    (@ronimarin)

    btw. I tried also:

    <?php if ( (is_front_page();) || (is_page(array(582));) || (is_paged() == 'false') ) { ?>
    <div>Something to include</div>
    <?php } ?>

    And it’s also not working! ??

    If you describe in words what you are trying to accomplish it might make it easier for others to assist.

    Thread Starter ronimarin

    (@ronimarin)

    Just about to do it… so here:

    IF I’m on a home page OR on specific page (but not on its paged pages) then include something, if not, just forget it ??

    Hope this is understandable.
    Thanks for helping out.

    ps. did I mention, I’m just learning and probably making stu**d mistakes…

    Assuming you have is_front_page() is what you want…

    <?php
    if ( is_front_page() || is_page('582') ) { ?>
    <div>Something to include</div>
    <?php } ?>

    See Conditional Tags

    Thread Starter ronimarin

    (@ronimarin)

    It still refuses to work!
    – I checked if cache is enabled, but not. Removed cache instructions from config file, and disabled cache plugin.
    – I tried also variation <?php if ( is_home() || is_page('holiday-news') ) { ?> but that also does not yield results…
    Any other ideas?
    I’m using this code within sidebar if that has anything to do with it.

    Could be something else messing with the query variables so put <?php wp_reset_query(); ?> right before your if statement to see if that resolves it.

    Thread Starter ronimarin

    (@ronimarin)

    Thanks Michael, that done the trick ??
    I was going crazy already…

    Thread Starter ronimarin

    (@ronimarin)

    Continued…. I still need the last bit.. if the page is paged then don’t show it!
    How do I properly say “if it is not paged”?
    Something like: <?php if ( is_front_page() || is_page('582') && !$paged ) { ?>
    In words:
    If it’s front page or page 582 but not paged …

    Thread Starter ronimarin

    (@ronimarin)

    I managed to do it this way:

    <?php if ( is_front_page() || is_page(‘582’) ) { ?>
    <?php if ( !(is_paged()) ) { ?>
    <div>Something to include</div>
    <?php } ?>
    <?php } ?>

    Is there a nicer way?

    Sorry I forgot the paged thing but something like:

    <?php if ( (is_front_page() || is_page('582')) && !is_paged() ) { ?>
    or even
    <?php if ( (is_front_page() || is_page('582')) && empty($paged) ) { ?>

Viewing 10 replies - 1 through 10 (of 10 total)
  • The topic ‘php if (bla bla) statement problem’ is closed to new replies.