Call to Actions
Insert advertisements and content blocks into an Ajax Load More query
The Call to Actions add-on provides functionality for injecting unique templates into an Ajax Load More query.
Easily include a custom Adsense advertisement block or call to action within each Ajax Load More post loop.
Features
A few key features of the Call to Actions add-on for Ajax Load More.
Advertisements
Generate revenue by injecting advertisements (Adsense etc.) as visitors load Ajax content.
Sign-up Forms
Increase engagement by inserting sign-up forms between content within the Ajax listings.
Featured Content
Call out important and relevant information to your visitors directly in the Ajax load content.
Add-on Details
Learn more about the Call to Actions add-on.
How It Works
The Call to Actions add-on works by providing an intuitive and user-friendly method for website admins to inject advertisements or call to actions directly into the results of each Ajax Load More query.
It’s as simple as choosing a display position within the loop and then selecting the Repeater Template that holds the call to action content.
Call to actions can be anything you want them to be… an advertisement, a featured article or even a sign-up form – it’s up to you to decide.
Note: This add-on requires an additional Repeater Template add-on for displaying call to actions. Please refer to the Requirements section in the sidebar for more info.
Implementation
The process for injecting call to actions into Ajax Load More results can essentially be split into two separate tasks.
- Creating a Template
This task will involve the creation of a custom template that will hold the content or HTML container of your call to action. - Building a Shortcode
With the Shortcode Builder, it’s as easy as selecting your call to action template and then choosing the injection point within the Ajax Load More loop.
Working with Advertisements
The majority of ad networks require JavaScript to trigger the display of their ads. Making use of the almComplete callback function will likely be required to load advertisements on the Ajax loaded content.
Examples
The following examples will provide an idea what can be done with the Call to Actions add-on:
Adsense
Displaying advertisements from Google Adsense with Ajax Load More.
Featured Content
Displaying a featured Ajax Load More add-on based on the current $alm_item value.
Random Quote
Using the almComplete callback function to inject a random quote call to action into Ajax Load More results.
Template
Inserting a call to action into Ajax Load More results will require a unique Repeater Template. This template holds the content of your CTA and will be injected into each loop at the position specified in the shortcode.
A typical CTA template is constructed similarly to standard Ajax Load More templates and may include a custom WP_Query, JavaScript or even hard coded content such as a mailing list sign-up or contact form.
Note: You should always open and close a call to action template with an HTML element.
e.g. <div class=’my-cta’>// CTA content </div>
Example Template
The following template is used in the Featured Content example and will display a featured add-on based on the current $alm_item value.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 |
<li class="alm-cta cta-callout"> <?php if($alm_item == 2){ $slug = 'rest-api'; }elseif($alm_item == 7){ $slug = 'custom-repeaters'; }elseif($alm_item == 12){ $slug = 'cache'; }elseif($alm_item == 17){ $slug = 'comments'; }else{ $slug = 'search-engine-optimization'; } $args = array( 'name' => $slug, 'post_type' => 'page', 'post_status' => 'publish', 'posts_per_page' => 1 ); $cta = get_posts($args); if( $cta ) { $id = $cta[0]->ID; ?> <a href="<?php echo get_permalink($id); ?>"> <div class="details"> <h4><?php echo get_the_title($id); ?></h4> <p><?php the_field('subtitle', $id); ?></p> <p class="btn">Learn More</p> </div> </a> <?php } ?> </li> |
Shortcode Parameters
The following shortcode parameters are available with the Call to Actions add-on.
cta | Enable call to actions. Default = ‘false’ |
---|---|
cta_position | Insert call to action {before/after} post #{x}. Default = ‘before:1’ |
cta_repeater | The repeater template that will display the call to action. Default = null |
cta_theme_repeater | The theme repeater that will display the call to action. (If activated) Default = null |
cta_position is a colon separated value where the first value is before/after and the second value is the post position (in the current loop) where the call to action will be inserted.
Shortcode Builder
The following screenshot illustrates the process of building a Call to Action shortcode using the Ajax Load More Shortcode Builder.
Example Shortcode
[ajax_load_more cta="true" cta_position="after:2" cta_repeater="template_19" post_type="post" repeater="default"]
Frequently Asked Questions
Below are common questions regarding the Call to Actions add-on. If you have a question and don’t see an answer here, please visit the support page and submit your request.
Yes, the almComplete callback function is available for all call to action templates.
Not yet, but this is something in the pipeline to be worked on.
For now, a potential workaround can be used that relies on ALM Variables to check the current page and only display the CTA template if it meets the criteria.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 |
<?php // Only display CTA if page is less than 5. if ( $alm_page < 5 ) { ?> <div> <!-- Ad Slot --> <ins class="adsbygoogle" style="display:block" data-ad-client="ca-pub-{PUB_ID}" data-ad-slot="{SLOT_ID}" data-ad-format="auto"> </ins> <script> (adsbygoogle = window.adsbygoogle || []).push({}); </script> <!-- / Ad Slot --> </div> <?php } ?> |
Installation
Upon purchase of this add-on you will receive a confirmation/purchase receipt email. Your receipt will contain a direct link for downloading your copy of Ajax Load More: Call to Actions and a license key.
After downloading the add-on, upload the unzipped files to your /wp-content/plugins/ directory or visit your plugins dashboard and upload the downloaded .zip under Add New.
License Activation
To activate your add-on and receive updates directly in your WordPress plugins dashboard users are required to enter the license key that was included with their purchase receipt.
To activate a license key:
- Visit the Licenses section within the Ajax Load More plugin.
- Enter the product key and click Activate License.
- If the status indicator turns green your add-on has been successfully activated (example below).
If you did not receive your confirmation/purchase receipt email and license key, please check your spam/junk folder and if you still cannot locate the email please contact me at darren [at] connekthq.com or use the Product Support form on the website.