• Resolved pharmanext

    (@pharmanext)


    Hi,

    I’m asking for your expert help in solving the following task correctly.

    It is necessary to rotate head_code_1 and head_code_2 in <head> of page.
    In this case, if head_code_1 is selected, it is necessary to implement the mandatory insertion of ALL other codes on the page, while if head_code_2 is selected, it is not necessary to do this.

    Let the codes to be inserted into the page are as follows:

    • page_code_1 (after the first paragraph)
    • page_code_2 (in the middle of the page)
    • page_code_3 (after the content)
    • page_code_4 (in the footer).

    First, in Settings I set a new hook (named Header) for the action wp_head.

    Then I created next blocks:

    BLOCK 1 — must be inserted before all other blocks used for group rotation

    [ADINSERTER ROTATE share="50"]
    
    [ADINSERTER group="head_code_1"]
    
    [ADINSERTER ROTATE]
    
    [ADINSERTER group="head_code_2"]

    BLOCK 2 — code for insertion into <head> of page (Insertion: Header)

    [ADINSERTER ROTATE group="head_code_1"]
    head_code_1
    
    [ADINSERTER ROTATE group="head_code_2"]
    head_code_2

    BLOCK 3 — code for insertion after paragraph 1 (Insertion: After paragraph 1)

    [ADINSERTER ROTATE group="head_code_1"]
    page_code_1
    
    [ADINSERTER ROTATE group="head_code_2"]
    nothing

    BLOCK 4 — code for insertion in the middle of the page (Insertion: After paragraph 0.5)

    [ADINSERTER ROTATE group="head_code_1"]
    page_code_2
    
    [ADINSERTER ROTATE group="head_code_2"]
    nothing

    BLOCK 5 — code for insertion after content (Insertion: After content)

    [ADINSERTER ROTATE group="head_code_1"]
    page_code_3
    
    [ADINSERTER ROTATE group="head_code_2"]
    nothing

    BLOCK 6 — code for insertion into footer (Insertion: Footer)

    [ADINSERTER ROTATE group="head_code_1"]
    page_code_4
    
    [ADINSERTER ROTATE group="head_code_2"]
    nothing

    Please give your answer to two questions.

    1. Did I set the logic in Blocks 1-6 correctly?

    2. What to do with Block 1, which is responsible for group rotation?
    Because according to https://adinserter.pro/documentation/ad-rotation#groups manual in case of client-side dynamic blocks there is no possibility to specify Block 1 insertion into <head>.
    But Block 1 must regulate the group rotation insertion as well as Block 2 into <head> and Blocks 3-6 into <body>.

    Thank you in advance for your informative answers.

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

    (@spacetime)

    Hello,

    your codes seem to be fine.

    1. Yes, it looks ok.

    2. Block 1 needs to be insertted also in the header. Since block number 1 is lower than 2, it will be processed before block 2.
    Create a custom hook for action wp_head and name it Header or something:
    https://adinserter.pro/documentation/header-and-footer-code

    And then set insertion for blocks 1 and 2 to Header.
    Both blocks will be inserted server-side.

    Thread Starter pharmanext

    (@pharmanext)

    Thank you very much for your reply.

    Do I understand correctly that the method you suggest (with sever-side insertion for Blocks 1 and 2) will work even if the _Client-side insert_ for _Dymanic Blocks_ is selected in the _General_ settings?

    Plugin Author Spacetime

    (@spacetime)

    Correct.

    WP hooks are always called server-side.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Group Rotation’ is closed to new replies.