Jump to content

How to stop sidebar ad from showing everywhere?


AlexWebsites

Recommended Posts

I have an odd problem with one of my sites...I have an ad with the location as sidebar. The ad is showing everywhere, topics, leaderboard, etc., when there are no other blocks. I just updated from 4.1.9 to 4.2.5 and can't seem to figure this out. I disabled all plugins to see and it still shows. I also checked the default theme to make sure it wasn't theme related and it shows there also. I tested my theme on another site of mine that is already on 4.2.5 before I upgraded this one. It's driving me crazy, is there  sidebar setting I'm missing somewhere? I'm about to look at the database to see if there are some rogue blocks listed and not showing causing the advertisement to show everywhere. Usually only shows if you have a block live, but in this case i removed all blocks and it still shows.

Link to comment
Share on other sites

I did the same thing and created a block. Not sure if its a bug. Are you running a custom or default theme? I just tested my theme on another 4.2.5 site and it's not doing it, although that site doesn't have the same plugins or pages. I also tested on another site (also 4.2.5) that has pages and it doesn't do it. So I don't think it's my theme its probably some sort of conflict with plugin or ad code I'm thinking, I don't know.

I'm also having pasting issue of images into posts on this one site.

Link to comment
Share on other sites

I corrected this by changing the code in 4.2.5 within front > global > sidebar back to the 4.1.9 code:

{{if (isset( \IPS\Output::i()->sidebar['enabled'] ) and \IPS\Output::i()->sidebar['enabled'] ) && ( ( isset( \IPS\Output::i()->sidebar['contextual'] ) && trim( \IPS\Output::i()->sidebar['contextual'] ) !== '' ) || ( isset( \IPS\Output::i()->sidebar['widgets']['sidebar'] ) && count( \IPS\Output::i()->sidebar['widgets']['sidebar'] ) ) || ( \IPS\Dispatcher::i()->application instanceof \IPS\Application AND \IPS\Dispatcher::i()->application->canManageWidgets() ) )}}
	<div id='ipsLayout_sidebar' class='ipsLayout_sidebar{$position} {{if !( isset( \IPS\Output::i()->sidebar['contextual'] ) && trim( \IPS\Output::i()->sidebar['contextual'] ) !== '' ) && ( !isset( \IPS\Output::i()->sidebar['widgets']['sidebar'] ) || !count( \IPS\Output::i()->sidebar['widgets']['sidebar'] ) ) && \IPS\Dispatcher::i()->application->canManageWidgets()}}ipsLayout_sidebarUnused{{endif}}' data-controller='core.front.widgets.sidebar'>
		{{if isset( \IPS\Output::i()->sidebar['contextual'] ) && trim( \IPS\Output::i()->sidebar['contextual'] ) !== ''}}
			<aside id="elContextualTools" class='ipsClearfix' {{if isset( \IPS\Output::i()->sidebar['sticky'] )}}data-ipsSticky{{endif}}>
				{expression="\IPS\Output::i()->sidebar['contextual']" raw="true"}
			</aside>
		{{endif}}
		{{if isset(\IPS\Output::i()->sidebar['widgets']['sidebar']) and count( \IPS\Output::i()->sidebar['widgets']['sidebar'] ) and ( \IPS\core\Advertisement::loadByLocation( 'ad_sidebar' ) ) }}
			{advertisement="ad_sidebar"}
			<br><br>
		{{endif}}
		{template="widgetContainer" group="global" app="core" params="'sidebar', 'vertical'"}
	</div>
{{endif}}

Now the load by location seems to be working again. It looks like in 4.2+ they went to 

{{if \IPS\core\Advertisement::loadByLocation( 'ad_sidebar' )}}

Instead of 

{{if isset(\IPS\Output::i()->sidebar['widgets']['sidebar']) and count( \IPS\Output::i()->sidebar['widgets']['sidebar'] ) and ( \IPS\core\Advertisement::loadByLocation( 'ad_sidebar' ) ) }}

 

Link to comment
Share on other sites

This is really weird. The advertisement set in the ACP > System > Site Promotion > Advertisements for the location "In the site sidebar" for my installation only shows when there are other widgets active in the sidebar. If no other widgets the sidebar doesn't appear at all including the ad. This is almost the opposite of what you're experiencing.

 

Link to comment
Share on other sites

42 minutes ago, thompsone said:

This is really weird. The advertisement set in the ACP > System > Site Promotion > Advertisements for the location "In the site sidebar" for my installation only shows when there are other widgets active in the sidebar. If no other widgets the sidebar doesn't appear at all including the ad. This is almost the opposite of what you're experiencing.

 

That's the way it's supposed to work I believe. You "turn on" the sidebar by adding at least one block. Them any ads tags as being for the sidebar in advertisements should show. For me it would show even with no blocks.

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.

  • Recently Browsing   0 members

    • No registered users viewing this page.
×
×
  • Create New...