• Resolved kwmarcum

    (@kwmarcum)


    Your documentation details the answer to “How can I make a snippet run on only a certain page?” but I’d like the snippet to appear on posts only. All of them. We have 3,000. Can you provide CSS code for that kind of conditional tag where the snippet appears on all posts but not on pages, archives, categories, etc.?

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

    (@bungeshea)

    In that case you can replace this line from the example:

    if ( ! is_page( [ 123, 'some-page-slug', 'Some Page Title' ] ) {

    with a different conditional that checks whether the current view is a post:

    if ( ! is_single() ) {

    Keep in mind that is_single() only returns true when you are looking at a full post, and not when it appears on the front page or in archives. There are more conditional tags to be found here if you need to customise further: https://developer.www.ads-software.com/themes/basics/conditional-tags/

Viewing 1 replies (of 1 total)
  • The topic ‘Snippet to appear on Posts only’ is closed to new replies.