WordPress Ad Server (CMAC) - Getting Started - Inserting Shortcode to the Theme Template


Inserting Shortcode in the Theme Template

Back to User Guides

When using the WordPress Ad Server, use the following PHP code to add a shortcode running your campaign anywhere in your template:

do_shortcode( '[cm_ad_changer campaign_id="1"]' );

A reference is available here: https://developer.wordpress.org/reference/functions/do_shortcode/

To insert the shortcode into a template, use the following PHP code:

<?php echo do_shortcode( '[cm_ad_changer campaign_id="1"]' ); ?>

You can also use the following filter:

$ads_content = '[cm_ad_changer campaign_id="1"]';

$ads_content = apply_filters('the_content', $ads_content );

echo $ads_content;


More information about the WordPress Ad Server plugin

Other WordPress products can be found at CreativeMinds WordPress Store

Let us know how we can Improve this Product Documentation Page

To open a Support Ticket visit our support center
Did this answer your question? Thanks for the feedback There was a problem submitting your feedback. Please try again later.