Contact: Web / Voice / Email / Tips
Simple Thoughts Blog - Java and Web Technologies

Simple solutions for complex problems.

 

How To Use AdRotator Within Your WordPress Post / Page

November 17th, 2006 by Angsuman Chakraborty

AdRotator Overview
WordPress plugin AdRotator enables you to display an advertisement (which is randomly selected from a group of advertisements specified in a text file) at your chosen location anywhere in your WordPress blog (other free WordPress plugins we provide).

Adding ad code is trvial. You simply add this code in your template, where you want to show the advertisement:
<?php echo getad('bannerad'); ?>

It searches for the file wp-content/bannerad.txt, chooses one ad randomly from it and displays it. You should replace bannerad with the name of your actual text file without the ending txt extension.
Ref: AdRotator User Manual

How to display rotating ads directly in your WordPress posts or pages?
The key problem is that WordPress doesn’t allow php code in your posts and pages. And the code above is php code. The solution is very simple.

You should use any one of the available plugins for this. One such plugin is Priyadi’s php-exec. It allows you to execute php code within your posts. To install php-exec follow these simple steps:

  1. Download the plugin: phpexec.txt
  2. Rename the plugin to phpexec.php and put it into your wp-content/plugins directory
  3. Activate the plugin from WordPress administration menu

Now all you have to do is use this code within your WordPress post, to display rotating ads:
<phpcode> <?php echo getad('bannerad'); ?> </phpcode>


Tags: CMS Software, Headline News, How To, Open Source Software, PHP, Pro Blogging, Tech Note, Web, Web Services, WordPress | | RSS 2.0 | Trackback this Article | Email this Article

You may also like to read

»Adding Quotations to Blog
»Get Insulted - Menu: Biblical or North Korean
»How To Display AdSense & Yahoo Publisher Ads Using AdRotator Plugin for WordPress
»WordPress Plugin: AdRotator - Ad Rotating Solution for your Ads (including AdSense, Clicksor, Chitika etc.)
»WordPress: How To Automatically Create Post Excerpt / Summary
»How To Display Sidebar in Single Post in WordPress 1.5 / 2.0 Default Kubrick Theme
»Simple tip for trackback spam prevention on WordPress Blogs
»WordPress: How To Create Multiple Paged Articles
»Files Changed from WordPress 1.5.1.3 to WordPress 1.5.2
»WordPress Plugins (Free) Developed and Supported by Taragana.Com
»For "WordPress Users Only" Section Started
»List of Files Changed in WordPress 2.03 wrt. WordPress 2.02
»How to have sidebar enabled in WordPress 1.5 Kubrick(modified) Post pages
»Blog Comments Problem Solved
»How To Add Single Quotes In WordPress Posts

4 Responses to “How To Use AdRotator Within Your WordPress Post / Page”

  1. WordPress Plugin: AdRotator - Ad Rotating Solution for your Ads (including AdSense, Clicksor, Chitika etc.) -Simple Thoughts - Java and Web Blog Says:

    [...] It can also be used to randomly include any other code or even to randomly display images, text messages etc. The usage is limited by your imagination only. You can also use it to display rotating advertisement within your posts or pages. [...]

  2. slider Says:

    All this is good. But can be exists ad-rotator to show advertising with a binding to categories?

  3. Matthew Moran Says:

    I activated the above plug in but whenever I add the addrotator PHP code, wordpress strips it out and makes it a comment.

    How do I correct this?

  4. Angsuman Chakraborty Says:

    You cannot include it in post directly. You have to use a plugin which allows you to insert PHP code within a post or page. You can however use it freely in your template.

  5. Chaz Says:

    Hi! I am a little confused. I am not finding out how to use your plug in to display graphical ads. From what I read here and in your User Manual, you can only display text ads. What if I wanted to display an animated .gif or .swf file with a link to one of my advertiser’s sites? What information goes in the .txt file?

    Also, you say that you can use this anywhere .php is supported. So, how do I use this outside of a blog - on a regular .php page?

Looking forward to hear your thoughts.



Please enter the code shown below ( to verify that you are human ) before you click Submit Comment.

No. 1 method to ethically increase your blog traffic and reach.

Translate

Translate to EnglishÜbersetzen Sie zum Deutsch/GermanPřeložit do Čech/CzechOversætte hen til Dansk/DanishKääntää jotta Finnish/FinnishLefordít -hoz Magyar/HungarianÞýða til Íslenska/IcelandicTraducir a Latinoamericano Español/Latin American Spanishtagapagsalin sa Filipino/FilipinoTłumaczyć wobec Polski/PolishA traduce la spre Român/RomanianPrevesti za Srpski/Serbiantolmačiti v slovenski/SlovenianÖversätta till Svensk/SwedishChyfieitha at Cymraeg/Welshtercüme etmek -e doğru Türk/TurkishPrevesti to Hrvatski/CroatianПревеждам към Българин/BulgarianTraduzca al Español/SpanishTraduisez au Français/FrenchTraduca ad Italiano/ItalianTraduza ao Português/Portuguese日本語に翻訳しなさい /Japanese한국어에게 번역하십시오/Korean中文翻译/Chinese Simplifiedترجمة الى العربية/ArabicVertaal aan het Nederlands/DutchΜεταφράστε στα ελληνικά/GreekПереведите к русскому/RussianOversetter til Norsk/Norwegian中文翻译/Chinese TraditionalTraduzir a Língua portuguesa brasileira/Brazilian PortugueseReddo ut Latin/Latin

Taragana Network

»Ctrl-S
»Enterprise Blog
»Free Book on Eye Care by Natural Therapy
»Health Care Blog
»Hot Computer Jobs Blog
»Pet Care & Grooming News and Tips
»Phil Law Blog
»Taragana - Software Outsourcing
»The Angsuman Chakraborty Blog
»The Diabetes Cure Blog
»The Eye Treatment Blog
»The Stem Cell Blog
»Weblog Hosting Blog
"Education is what remains after one has forgotten everything he learned in school." - Albert Einstein