Viewing 1 replies (of 1 total)
  • Plugin Author Shea Bunge

    (@bungeshea)

    A mechanism for doing this already exists.

    At the top of your snippet, you can use any of the conditional tags to determine which sort of page it is currently. Then, use the return keyword to exit out of the snippet.

    Here’s an example:

    if ( ! is_page( 'contact' ) or ! is_post( 42 ) ) {
        return;
    }
    
    // ... rest of snippet ...

    Have a look at PHP Logical Operators for more information.

Viewing 1 replies (of 1 total)

The topic ‘Scope to specific post or page’ is closed to new replies.