Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author gfazioli

    (@gfazioli)

    Hi,
    just use before and after settings (container_before e container_after too) in PHP code o Widget options.

    For example, the code below:

    <?php wp_bannerize('container_before=<div>&container_after=</div>&before=<span>&after=</span>'); ?>

    Output will be:

    <div>
    <span><a href=".."><img src="..." /></a></span>
    <span><a href=".."><img src="..." /></a></span>
    ...
    </div>

    regards
    GF

    Thread Starter brightweb1

    (@brightweb1)

    Not work for me =/

    I followed your instruction and use this code in template:

    <?php wp_bannerize('container_before=<ul>&container_after=</ul>&before=<li>&after=</li>'); ?>

    But the final result is:

    <div class="wp_bannerize ">
    <li><a href=".."><img src="..." /></a></li>
    </div>

    Am I doing something wrong? Thanks

    [ Please do not bump, it’s not permitted here. ]

    I’m having the same problem as @brightweb1, I just downloaded v3.0.62 with WordPress v3.4.2, and the container_before and container_after attributes do not change the output, it is still

    <div class="wp_bannerize Home Page Banners">
    ...
    </div>

    Even when they’re set to <ul> and </ul>, respectively.

    Any help is much appreciated!

    UPDATE:

    I noticed deep in the plugin readme files that the container_before and container_after attributes have been deprecated. This is unfortunate, but as a result I’ve built a work-around function that I hope helps people:

    //Customize wp_bannerize plugin html output
    function custom_bannerize($group_name) {
    	if( function_exists( 'wp_bannerize' )) {
    		global $wpBannerizeFrontend;
    		// Setup args as you would for normal wp_bannerize() call
    		$bannerize_args = 'group=' . $group_name . '&before=<li>&after=</li>';
    		// Get result of initial bannerize call (without the default 'echo' call) via %plugins_dir%/wp-bannerize/Classes/wpBannerizeFunctions.php
    		$str_banners = $wpBannerizeFrontend->bannerize( $bannerize_args );
    		// Replace container elements with desired ones
    		$str_banners = str_replace(array('<div class="wp_bannerize ' . $group_name . '">','</div>'), array('<ul class="myClasses">','</ul>'), $str_banners);
    		// Remove hardcoded <img> tag height & width params (OPTIONAL)
    		$str_banners = preg_replace('/(width|height)="\d+"(\s|)/', '', $str_banners);
    		return $str_banners;
    	} else {
    		return false;
    	}
    }

    It’s unfortunate that these were deprecated as it removed a significant amount of versatility from the plugin. I don’t know the circumstances of the removal but I would encourage that they be reinstated in the plugin (or at least removed from all readmes on wordpress.org).

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘[Plugin: WP Bannerize] Add container before and after images’ is closed to new replies.