• Resolved David Bennett

    (@djbdjb)


    Hi

    The plugin’s working great when targeting a single page but I want to target a few using an array – is that possible?

    This works fine:
    <?php if ( is_page(7265)) { ?>

    This doesn’t work:
    <?php if ( is_page(array(7265,7290,8471,10680,8356)) { ?>

    Not the end of the world if not, I just copy the code five times ??

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter David Bennett

    (@djbdjb)

    I’ve answered my own question, I was missing a closing bracket!

    <?php if ( is_page( array( 7265, 7290, 8471, 10680, 8356 ) ) ) { ?>

    Plugin Author Stefano Lissa

    (@satollo)

    uhm I don’t like too much that code. Check the array_search() php function instead.

    Pay attention to use !== false on the result (two “=”).

    Stefano.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Using Arrays’ is closed to new replies.