• Resolved giossicom

    (@giossicom)


    Hi there,
    I’m using the latest version of your plugin and WordPress 4.1 with 5 different blogs.
    I made a manual update using MySql over your plugin code, so I went from [ad#300×250] to [ad name=”300×250″]
    So far so good, but for a single blog in which the theme supports the native WordPress advertising management system. At least, this is what I understood…

    I get this error

    [ad] Empty ad slot (#1)!
    Empty ad slot (#1)!

    As far as I could understand, if I place the adsense code into the native ad manager, the adsense block is shown.

    So, looks like your plugin is overridden by this native adverts manager and it can’t manage your plugin shortcode.
    Could it be possible?
    Even if I found a workaround, I would prefer using your plugin.

    If you google the error (https://goo.gl/BuHSj3) you’ll find a lot of errors like the one I’m writing about.

    https://www.ads-software.com/plugins/advertising-manager/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Thread Starter giossicom

    (@giossicom)

    Just because I’m an old and long time software developer, I decided to dig the problem and… I found it and fixed.
    I don’t know nothing about wordpress, as a developer, and know just bits of php.

    I’m using a theme which implements in the theme options an advertisment manager. To make my ads work, I had to fill a textfield in the theme options. By doing it, my ads started to work (this happened like 5 minutes after my 1st post).
    But… I never liked it, because there is no options around this manager and its general behaviour was not satisfying me…

    So, today I had 20 minutes to spend for me and…
    – I found a file, shortcodes.php, in the “library” folder of the theme.
    – in this file I replaced this line
    add_shortcode('ad', 'theme_advertisement');
    with
    //add_shortcode(‘ad’, ‘theme_advertisement’);

    then I checked what the
    function theme_advertisement
    really does…
    Well, in 5 seconds I decided that It wuold have been better to comment it… LOL

    From this

    function theme_advertisement($atts){
    
    	extract(shortcode_atts(array(
    
    		'code' => 1,
    
    		'align' => 'left',
    
    		'inline' => 0
    
    	), $atts));
    
    	$ad = theme_get_option('theme_ad_code_'.$code);
    
    	if(!empty($ad)):
    
    		$ad = '<div class="ad align'.esc_attr($align).'">'.$ad.'</div>';
    
    		if(!$inline) $ad .= '<div class="cleared"></div>';
    
    		return $ad;
    
    	else:
    
    		return '<p class="error"><strong>[ad]</strong> '.sprintf(__("Empty ad slot (#%s)!",THEME_NS),esc_attr($code)).'</p>';
    
    	endif;
    
    }

    to this

    /*
    function theme_advertisement($atts){
    
    	extract(shortcode_atts(array(
    
    		'code' => 1,
    
    		'align' => 'left',
    
    		'inline' => 0
    
    	), $atts));
    
    	$ad = theme_get_option('theme_ad_code_'.$code);
    
    	if(!empty($ad)):
    
    		$ad = '<div class="ad align'.esc_attr($align).'">'.$ad.'</div>';
    
    		if(!$inline) $ad .= '<div class="cleared"></div>';
    
    		return $ad;
    
    	else:
    
    		return '<p class="error"><strong>[ad]</strong> '.sprintf(__("Empty ad slot (#%s)!",THEME_NS),esc_attr($code)).'</p>';
    
    	endif;
    
    }
    */

    TL;RT
    There was another ad catcher in the code, so the advertising manager functionality was overridden by another piece of software, which was set in the theme options (not as plugin).

    I hope this might help someone else.
    Happy coding

    Plugin Author switzer

    (@switzer)

    giossicom: Thanks for working through this!

    For other readers who find this topic. The theme_advertisement() function is part of themes generated using the Artisteer tool.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[ad] Empty ad slot (#1)! error’ is closed to new replies.