Viewing 9 replies - 1 through 9 (of 9 total)
  • Plugin Author Spacetime

    (@spacetime)

    Thread Starter giuliametup

    (@giuliametup)

    Hi,
    you can see a test here: https://themevelvet.metup.it/2021/10/13/ciao-mondo/

    In first page of the post blocks are both inserted, in pages loaded with ajax only the block without category check is inserted.

    Thank you,
    Giulia

    Plugin Author Spacetime

    (@spacetime)

    Remote debugging doesn’t seem to be enabled.
    Please check.

    Thread Starter giuliametup

    (@giuliametup)

    Sorry, it should be active now

    Thank you

    Plugin Author Spacetime

    (@spacetime)

    For pro questions please use this form:
    https://adinserter.pro/contact#help

    Your question mainly apply also to the free Ad Inserter so I’ll answer them here.

    Basically, the plugin checks post category before insertion. The information is obtained by calling WP function get_categories (). In terms of WP page type Ajax calls are not posts nor pages and consequently have no category assigned.

    You can put this shortcode into block code to see what category the plugin sees:
    [adinserter data='categories']

    And your settings have many issues.

    Block 1

    Any code before the first viewport option will be inserted for all viewports (no viewport) – in your case HTML comment.

    This option is wrong. You can’t use viewport and check shortcode together:
    [ADINSERTER VIEWPORT="Desktop" CHECK category="oroscopo"]

    Theoretically you can use VIEWPORT separators inside CHECK options, however, in Ajax calls this will not work:

    [ADINSERTER CHECK category="oroscopo"]
      [ADINSERTER VIEWPORT="Desktop" ]
      [ADINSERTER VIEWPORT="Phone" ]

    Block 2

    id adv-block is not unique – it is used more than once.

    Thread Starter giuliametup

    (@giuliametup)

    Hello and thank you for your answer.

    The code we are requesting support for is in block 1. Not the commented code, but the one that loads the adv.
    The id of each block is generated at the time adv slot is initialized.
    However included code has nothing to do with how the plugin works.

    So ultimately we can’t control the category in ajax calls, right?

    Thank you
    Giulia

    Plugin Author Spacetime

    (@spacetime)

    Right.

    Unless you are able to pass some additional url parameter to the Ajax request which can then be used as a condition to insert blocks.

    Thread Starter giuliametup

    (@giuliametup)

    Hi,
    thanks for the tip!

    We were able to pass the parameter in ajax call.
    How can we check the condition inside block?

    Thank you
    Giulia

    Plugin Author Spacetime

    (@spacetime)

    You can black/whitelist block for url parameters:
    https://adinserter.pro/documentation/black-and-white-lists#url-parameters

Viewing 9 replies - 1 through 9 (of 9 total)
  • The topic ‘Category check in ajax call’ is closed to new replies.