• Resolved adam555

    (@adam555)


    Hi,

    I’d like to insert a reusable blocked using a shortcode and Ad Inserter to enable me to filter the pages it appears on as using a reusable block on the post template places it on every page which I don’t want.

    Can anyone help me with the code? I’m trying the following in Ad Inserter but it isn’t working:

    <div>
    <pre class="wp-block-code"><code>[reblex id='12178']</code></pre>
    </div>

    Happy to hear of any alternative suggestions of achieving this as well.

    Many thanks,

    Adam

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

    (@spacetime)

    Shortcode [adinserter data='reusable-block-N'] will generate reusable block with id N (it is also possible to use shortcode [adinserter name='reusable block name']).

    https://adinserter.pro/documentation/manual-insertion#shortcodes

    Thread Starter adam555

    (@adam555)

    Thanks for your quick response. So the code options I have are:

    Shortcode: [reblex id=’12178] or PHP function: reblex_display_block(12178)

    How would I actually place either of these in Ad Inserter to display the block which has already been created in WordPress?

    Many thanks,

    Adam

    Plugin Author Spacetime

    (@spacetime)

    WP shortcodes can be used directly, the plugin calls WP function do_shortcode (). to expand them. PHP code needs to be inside PHP tags <?php ... ?> and PHP processing needs to be enabled:
    https://adinserter.pro/documentation/code-editing#php-code

    Thread Starter adam555

    (@adam555)

    Thanks for this. So can I just paste [reblex id=12178] directly into Ad Inserter? It doesn’t seem to be working.

    Sorry, I’m not familiar with doing this.

    Many thanks,
    Adam

    Plugin Author Spacetime

    (@spacetime)

    Yes. For support on the shortcode I can’t help you much as Ad Inserter only calls WP function do_shortcode () to expand it. I would suggest asking their support to confirm this is all that is needed.

    Thread Starter adam555

    (@adam555)

    Thanks once again. It seems that the shortcode might be the problem. I’ll follow this up with them.

    Thread Starter adam555

    (@adam555)

    Sorry, just to add, when I paste the shortcode even the brackets surrounding it are in red suggesting a problem? Do I need to add any other code? Thanks

    Plugin Author Spacetime

    (@spacetime)

    No, use the shortcode as it is.

    Thread Starter adam555

    (@adam555)

    Thanks. This is what it looks like, but it seems there’s a problem:

Viewing 9 replies - 1 through 9 (of 9 total)

The topic ‘Using Ad Inserter to place shortcode’ is closed to new replies.