Community Forums › Forums › Archived Forums › Design Tips and Tricks › How to inject AdRotate into specific page
Tagged: AdRotate
- This topic has 3 replies, 2 voices, and was last updated 10 years, 3 months ago by Angela.
-
AuthorPosts
-
August 26, 2014 at 1:17 pm #121181AngelaMember
Theme: deprecated Lifestyle theme (Will be upgraded to a new theme in two weeks.)
WP: 3.9.2
Genesis: 1.8.2 (will be updated in two weeks with new theme)
Site: http://brownfieldagnews.comWe switched back to the AdRotate plugin after a frustrating year with OpenX. I have two pages that have sponsorships and need only certain ad groups to show on those pages.
According to AdRotate, you can add some code to your theme to make this happen - but I'm not quite sure how to go about that.
From AdRotate:
Using PHP
Insert the following PHP code in index.php, page.php or single.php of your theme. Anywhere where you want the banner to show, as many as you like.
And for showing a group use this (where 12 is the group ID):
echo adrotate_group('12');
I'm assuming I need to attach the specific page to the "echo," but not sure how to do it.
Anyone done this, or can offer advice on this? When our theme is updated, our designer will handle the mobile responsive queries. I just need a quick fix for the next two weeks.
Thanks for any info you can provide!
Angela – I write fiction, review books and get walked daily by a big dog.
August 26, 2014 at 4:15 pm #121213NickParticipantSince you're using widgets to display your ads, you could simply create an additional AdRotate widget that holds your special sponsor ad group (in Appearance > Widgets), add it to the sidebar you want it to appear in, and then use a plugin such as Display Widgets or Widget Logic to hide and show your chosen ads/widgets on specific pages.
Using the Display Widgets plugin, you could set the default ad widget to not display on the sponsor pages, and set the sponsor ad widget to display on those pages. You may have to add several of these alternative ad widgets – one in your Header Right area and another in the sidebar, for example – but it sounds like a simpler solution than hard-coding ad groups directly into your template files. (You Header Right and your Primary Sidebar areas would then contain two ad widgets, and you'd control which of these appear on what pages with the Display Widgets plugin.)
If you need to display a specific ad group in a given page or post inline with the content (i.e. not as a widget, but after the content or between paragraphs halfway through the post), the best way to do that is with the
[adrotate]
shortcode. For example, adding this shortcode to the WordPress post editor will make ad group 1 appear at that point:[adrotate group="1"]
August 26, 2014 at 4:29 pm #121218NickParticipant[Hmm. I edited a reply I posted here and it disappeared. Trying again! Sorry if this is a duplicate.]
Since you're displaying your ads using AdRotate widgets, you could create special sponsor ads that only display on one page by following these steps:
- Install the [Display Widgets plugin](http://wordpress.org/plugins/display-widgets/).
- Add an extra AdRotate widget to your Header Right and Primary Sidebar areas that each contain the sponsor's ad or ad group.
- Set the Display Widgets option in the sponsor's ad widget to show that widget on the sponsor's pages only.
- Set the Display Widgets option in the default ad widget to hide that widget on the sponsor's pages.
To me, that seems a cleaner and more manageable option than hard-coding the ad groups into your theme files.
If you need to display specific ad groups at the bottom of specific pages, or in between paragraphs within a certain page, you can use the
[adrotate]
shortcode in that page's content:[adrotate group="1"]
That will display the first ad group at whatever point you add it to the article.
August 27, 2014 at 7:06 am #121295AngelaMemberThanks! I will check this out!
Angela – I write fiction, review books and get walked daily by a big dog.
-
AuthorPosts
- The topic ‘How to inject AdRotate into specific page’ is closed to new replies.