WP-Addpub banners management (wordpress Plugin)

Hello,

WP-addpub is a very simple plugin that let’s you upload your banners or your html and javascript code to your blog. Can be used, also, for any kind of script (google adsense, paypal donate, youtube video…)

The advantages of this plugin:

* Enabling and disabling the banner
* Display banners in different areas.
* Ability to display a banner depending on any special field (category, tag,…).
* Ability to display a banner depending on the language using the field filter.
* Ability to add/edit a script banner ( since 1.2).
* Ability to display a random banner ( since 1.2.1).

Requires WordPress Version: 2.3 or higher

Installation:

1. Unzip the file and place the folder wp-addpub in the directory plugins wordpress \ wp-content \ plugins
2. Activate the plug wp-addpub
3. Go on the management of banners in the Options> WP-Addpub

Screenshot :


How-to use:

Add the following line in your theme:

  1. <?php wp_addpub ( "bannerID=1" ) ; ?>

The parameter of the function is a string that contains variables:

* bannerID : Id of the banner
* zone: a text field that can be used to identify an area of your page (eg sidebar,… footer)
* filter: a text field that can be used as a criterion for display (ie value: French, English or Category1, Category2…)
* random : display a random banner (random=true) (since version 1.2.1)

These variables can be used separately or together (example: “zone=sidebar&filter=EN”)

Changelog 1.2.5:
[+] add CDATA to javascript code to ignore by the validator (Thanks to by Jorge)
[+] add the full url to swfobject (Thanks to Jorge)
[+] add width to the banner type input
[-] bug fixed : when updating a banner without uploading a new file, it changes to html code.

Changelog 1.2.4:

[+] code optimization
[-] bug : user level access set to 8 (Thanks to Lars Schenk)
[-] bug : error when adding a html banner (Thanks to inklude)

Changelog 1.2.3:

[-] bug div id when displaying many swf in the same page.
[+] show error if cannot upload the file

Changelog 1.2.2:

[-] bug ie7 resolved. Thanks to Tony V

Changelog 1.2.1:

[+] Display a random banner using random argument. e.g. : wp_addpub (“zone=sidebar&random=true”);

Changelog 1.2:

[+] Accept a script as a banner
[+] Check if there is a new version of the plugin
[-] Correct bug : Edit banner

Changelog 1.1:

[+] add new file “swfload.swf” => enable to click an swf banner
[-] BUG Display flash
[-] Change varchar(255) to TEXT



Download the current version from wordpress.org plugin directory:

http://wordpress.org/extend/plugins/wp-addpub/

127 Responses to WP-Addpub banners management (wordpress Plugin)

  1. Didikajah says:

    i want to show the 3 banners with that code, is there any mistake?

  2. admin says:

    Can you please put here your code for the three banners ?

  3. Didikajah says:

    i use the latest version, from the link to wordpress above… but my wp is 2.8.2

  4. admin says:

    Hello,

    What version of wp-addpub you have ?

    The bug was reloved in 1.2.3

    Thx

  5. Didikajah says:

    how to show a php code in comment?
    i’ll write without php tag

    wp_addpub(“filter=banner”)

  6. Didikajah says:

    here is the code

  7. Didikajah says:

    hi, i’ve put the code to display 3 banners in my header. but unfortunately it only show 1 banner. what’s the mistake???

    thx

  8. igor says:

    ou, I know what problem is it. Plugin don’t supports non latin in tatles

  9. igor says:

    when I download banner – Banner was added successfully. But in fields – no banners found. On local with same theme plugin works good. I look on server and saw that images load successfully. Why banners don’t show in admin panel?

  10. Magnus Olander says:

    This is a great plugin and it works very good. But unfortunatly there is no ALT-attribute in the [img] tag when you upload a banner and alt-attribute is required in HTML/XHTML. Could you please just add a alt=”” to the IMG-tag created by the plugin. That way it won’t break my pages.

    Functionality request- would it be possible to get banner images from the media archive/store the uploaded banners in the media archive?

    Thanks a lot for a great plugin!

  11. admin says:

    Thank you very much. The tracking will be included soon in the next version.

  12. bj says:

    This works a treat, is easy to set up and use, and is pretty flexible. Thank you so much!

    The only improvements I can envision would be some sort of tracking, and maybe widgets for the different zones, if that’s possible. Tracking would be especially helpful.

  13. Nancy says:

    Sorry not sure how to post code.

  14. Nancy says:

    Hello,

    I am using your plugin and it’s great except for one thing. I have two banners set up in the sidebar and they are appearing randomly. The part that I can’t get to work is the field. When I switch between English and French I want only banners specific to the language to appear, but that part is not working.

    Below is the code that I have set up:

    When I use the wordpress admin for the plugin and specify the field to be english or french it doesn’t work.

    I’ve tried different variations with no luck (e.g. en, English, en_EN, en_US).

    Is there a solution?

    Thanks!

  15. Stanley says:

    Hi,

    can you give me a sample how I can filter for some Tags?!

    *Sorry for my english!

    Stanley

  16. Alex says:

    Hi wareteam, nice job but without tracking there is no point in managing banners.

    I´ve been searching for 3 days for a plugin which cover this requirements: easy flash banners integration, tracking, rotation and banner locations. But no luck. This one looks great when tracking is solved.

    Muchas Gracias!

  17. admin says:

    Hi dede,

    Thank you very much, I really appreciate any kind of suggestion. Your ideas are welcome.

    The stats system is a very interesting feature that i hope will be part of the next version (major version 2.0)

    I’ll keep posted.

  18. dede says:

    hello,

    i really love this plugins, but can i suggest for next release? can you make the tracker too, so how many times that banner shows and how many clicks that banner clicked by user.

    thx

  19. admin says:

    Hello iva,

    Try to update the plugin to 1.2.5 and put the code to the file footer.php regarding to the zone you’ve mentionned.


    < ?php wp_addpub('bannerID=1');?>

    or the following code is recommended because the ID is unique and can’t be changed if you remove it so you have to change the code in the theme again.


    < ?php wp_addpub('zone=footer');?>

  20. admin says:

    Hello Jorge,

    Thank you very much. I’ve just commited a new version.

    changelog 1.2.5: http://wordpress.org/extend/plugins/wp-addpub/changelog/

    Waiting for your feedback.

  21. iva says:

    Hellou,

    Can you help me? In witch php file for theme do I need to put

    I put in index.php , zone :footer, ID is 1 but it didn´t show.
    Banner is swf file, and it is activated.

  22. admin says:

    Hi Jorge,

    Sorry, it’s not included yet. I’ll commit that in a new version this weekend.

    I’ll keep you posted.

  23. Jorge says:

    Hi,

    Before updating I’d like to know…

    Is this new version including the CDATA tag to make it valid? I made that adjustment on my local copy of the plugin as I mentioned a couple of weeks ago. Also I mentioned here that there is a problem with the SWF banner deployment depending on your permalink structure so I also added a get_bloginfo(’url’) to solve that. Is this also included in the new version?

    Thanks.

  24. admin says:

    Another bug reported by “inklude” http://wordpress.org/support/topic/283778?replies=4

    Changelog 1.2.4:

    [+] code optimization
    [-] bug : user level access set to 8 (Thanks to Lars)
    [-] bug : error when adding a html banner (Thanks to inklude)

  25. admin says:

    Hello Lars,

    Thank you very much for reporting this bug. I’ve just commited the plugin.

    Changelog 1.2.4:
    + Code optimization (select only the active banners)
    – bug: user level access set to 8 ( http://codex.wordpress.org/User_Levels#User_Level_8)

    Thanks

  26. Lars Schenk says:

    Some may also change the user_access_level from 1 to a higher level. This will prevent “normal” users to see and access the backend page.

    Change in wp-addpub.php
    add_submenu_page(‘options-general.php’, ‘WP Addpub’, ‘WP AddPub’, 8, __FILE__, ‘wp_addpub_page’);

  27. Juan Pablo says:

    Hi,
    i need to make that when i upload a banner of certain dimensions, the plugin resize that banner automatically. exmpl: if i have a banner of 123×12 the plugin resize it to 230x84px… i have tried with CSS but it doesn’t work…

    please,
    and thanks again for this great plugin!
    greetings.

  28. Lars Schenk says:

    Please change the following line in function

    function wp_addpub($args = “”)

    from

    $sql = ‘SELECT * FROM ‘.$table_banners.’ WHERE ‘.$WHERE.’ ‘.$ORDERBY.’ LIMIT 1;';

    to

    $sql = ‘SELECT * FROM ‘.$table_banners.’ WHERE ‘.$WHERE.’ AND ACTIVE=\’1\’ ‘.$ORDERBY.’ LIMIT 1;';

    This will allow to select only active adds. Otherwide deactivated adds will prevent other active adds to be shown. Thanks.

  29. admin says:

    You should have many banners. Probably with only 2 or 3 it appears with the same ID. (try to refresh the page many times)

  30. Gilberto says:

    Hi, I have tried the random function and it changed once, then the same banner always appeared… I don’t understand.

    Thanks for your help.

    I just discovered that script seems to block the Flash banner own LINK, even if I don’t use any link in the database.

  31. admin says:

    Hello,

    Actually, you can do that. you can rotate all banners using random=true and if you use it with the field zone or/and filter you can display a random banner by categories or/and zone

    e.g.:

    
    < ?php 
    wp_addpub("random=true&zone=sidebar");
    ?>
    
    or 
    
    < ?php 
    $catid = get_the_category(); // get the ID of the category
    // show a random banner that has filter equal to the cat id and the zone is equal to sidebar
    wp_addpub('random=true&zone=sidebar&filter='.$catid[0]->term_id); 
    ?>
    

    Thanks

  32. Gilberto says:

    Sorry, The line was not show in my last message… so here it is…

    [php $a=array( ‘8’, ‘9’); wp_addpub ( “bannerID=” . $a[array_rand($a)] ); /php]

  33. Gilberto says:

    I have a simple solution for rotating the banners…

    And I just replaced the line with this code:

    It will random show any of these bannerId’s, just remember to create the array with the bannerid that correspond to the zone you are using the banner.

    Hope it could help, while we wait for version 1.3

  34. Jorge says:

    Ok, I can’t make it work with the PRE tags but on line 224 the ALT tag needs to be added aswell. I have it now like:

    alt=’ad space’

    But a variable can be added there too.

  35. Jorge says:

    I thought by using PRE tags… let me try again:

    echo ”
    //ID.”\”);
    // ]]>
    “;

  36. Jorge says:

    After the last modification were I included the blog URL to call absolutely the swf I was able to see the banners on deeper folders with my permalink structure. However, the code that calls the swf won’t pass the w3c validation. So I added CDATA tag online 97 and 101 like this:

    echo ”
    //file_url).”&href=”.urlencode($Recordset[0]->file_link).”&target=”.$Recordset[0]->target.”\”, \””.addslashes($Recordset[0]->title).”\”, \””.$Recordset[0]->width.”\”, \””.$Recordset[0]->height.”\”, \””.$Recordset[0]->version.”\”);
    so.write(\”wp-banner_div_”.$Recordset[0]->ID.”\”);
    // ]]>”;

  37. Carol says:

    I need more specific instructions for how to show a different banner in the sidebar of each category.

    When I’m adding a new banner, for “zone” would I put “sidebar” (without quotes, of course) and do I specify right or left? Does it really matter since I am inserting the code there myself? And how do I word “filter”? … “cat=red widgets” or “category=red widgets” or “$catid = getthecategory();”???

    Then if I have 10 categories, do I put 10 lines of code into the sidebar template? What wording to I use to specify the categories there?

    Thanks for any help you can provide. I really want to get this working.

  38. Clayton says:

    Polls

    <?php mw_recent_comments(7, false, 38, 20, 40, ‘all’, ‘%author_name% – %title%‘,’d.m.y, H:i’); ?>

  39. Clayton says:

    I hope you can delete these comments that are not working for me. The bottom line is that my sidebar code now has li and ul tags for the other items. when I put in the one line of code as per the installation instruction above into the sidebar.php file, nothing happens so I am wondering if I should add div tags etc?

  40. Clayton says:

    I have read and tried the related info in the above comments but because I have a customised template I think something may be different as the following code in my sidebar does not work. A number of other configurations with ul and li tags does not work for me either. When I install wp-addpub-banners, is there related code in functions or something? If there is, I will go there and check to see if it exists.

    Polls

    <?php mw_recent_comments(7, false, 38, 20, 40, ‘all’, ‘%author_name% – %title%‘,’d.m.y, H:i’); ?>

  41. admin says:

    Test :

    < ?php echo "code just added between a < pre>< /pre>"; ?>
    
  42. admin says:

    Hi,

    You can add your code with a pre or code tags

    < pre> your code < / pre>

    pre without spaces

  43. Clayton says:

    sorry – how do i add code to a comment?

  44. Clayton says:

    I have read and tried the related info in the above comments but because I have a customised template I think something may be different as the following code in my sidebar does not work. A number of other configurations with ul and li tags does not work for me either. I may be missing something in functions????

    <?php mw_recent_comments(7, false, 38, 20, 40, ‘all’, ‘%author_name% – %title%‘,’d.m.y, H:i’); ?>

  45. Jorge says:

    Feel free to check your plugin making it happen on http://wearetrends.com

    I’m almost finished with it!

    :D

  46. Jorge says:

    Hi,

    Thanks for the update. I think I found another glitch. Depending on your permalinks structure your flash ads wont show on the deeper folders. I changed a line (line 98 on wp-addpub.php) to include the absolute path to the url from this:

    var so = new SWFObject(\”wp-content/…..

    to this:

    var so = new SWFObject(\””.get_bloginfo(‘url’).”/wp-content/…..

    it worked for me ;)

  47. admin says:

    Dear Jorge and Juan,

    I fixed the issue and updated the plugin

    You can download the new version from :

    http://wordpress.org/extend/plugins/wp-addpub/

    see the changelog :

    http://wordpress.org/extend/plugins/wp-addpub/changelog/

    Thank you very much for you help.

  48. admin says:

    Don’t let it bother you :)

    the problem was already solved in my local copy. i’ll commit that tomorrow.

    I’ll keep you informed when it’s done. Thank you.

  49. Jorge says:

    Ok… I could fix that but I’m not able to write a simple post with code in it… same on me! How do we include HTML and PHP code here?

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>