Support » Plugins » Plugin/Shortcode to post specific ads on specific pages?

  • Looking for an ad management program that will let me insert a shortcode into sidebar.php… let’s say it’s called [adGoesHere]. Then in the admin side I could upload the image, type in the link and specify the page for it to show up on. So ad_001 would only show up on About Us, ad_008 would only show up on Services, etc.

    Anything like that already exist? I’ve been hunting but can’t seem to find anything like it. My only other option seems to be custom templates but that’d be a pain for my client to maintain.

    Thanks in advance.

Viewing 2 replies - 1 through 2 (of 2 total)
  • Hi there,

    You don’t really need a plugin to accomplish this. You can do it yourself through some of WP’s default functions.
    Here is how I would do it:
    1. Add a custom self-enclosing shortcode function through the WordPress Shortcode API, which would have an ‘add_number’ argument, so you could call any of your ads like this:

    [adGoesHere ad_number="1"]

    2. If you don’t already have them, install Exec-PHP and Role Manager plugins. The first one allows you to run PHP code in your posts, pages, and widgets, and the second one controls which users have PHP execution capabilities (for security). There are many role and capability managing plugins out there, so if you already have one, just use that one.

    3. Create a new widget in your sidebar and use php multiple if statement to call the ads depending on the location. Some examples:

    <?php if ( is_home() ) {
    echo '[adGoesHere ad_number="1"]';
    elseif { is_category('6') ) {
    echo [adGoesHere ad_number="2"]';
    } else {

    For is_category, you should replace the value 6 with the value of the category for which you want the Ad displayed. If you don’t know how to implement any of this, let me know and I’ll walk you through it.




    Were you able to figure this out? If so, could you please mark this topic as resolved?


Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Plugin/Shortcode to post specific ads on specific pages?’ is closed to new replies.