Osclass forums

Support forums => Themes => Bender => Topic started by: jimzubemo on August 25, 2017, 10:30:54 pm

Title: [SOLVED]OSCLASS Ads management - Disable ads on Login, Register, Error Pages etc
Post by: jimzubemo on August 25, 2017, 10:30:54 pm
As per Google Adsense Ad placement policy, it states that -
"Publishers are not permitted to place ads on any non-content based pages like thank you, error, log in, or exit pages. "
More info here: https://support.google.com/adsense/answer/1346295?hl=en#Ads_on_non_content_pages

Bender theme and Bender_Black Theme has "Ads Management" in Theme Settings, using which we can place Google Adsense on various regions such as Header, Search Results Page Top & Bottom, Sidebar etc. This provision is very convenient instead of placing ads manually in php files.

But ads (placed in Header) also apears on Login, Register and also on error pages, which may cause issues with Google Adsense later.

I have the following code in header.php

<?php if( osc_get_preference('header-728x90', 'osclasswizards_theme') !=""){ ?>
<div class="ads_header ads-headers"> <?php echo osc_get_preference('header-728x90', 'osclasswizards_theme'); ?> </div>
<?php } ?>

and

user-login.php includes the header.php
osc_current_web_theme_path('header.php');

I want to continue to use the default ADs Management feature. But how to disable Ads from appearing in login, register pages etc.?

We can disable content from displaying using CSS code. But in this case, I can't think of selectively disabling depending on page type

Any help is appreciated.
Title: Re: OSCLASS Ads management - Disable ads on Login, Register, Error Pages etc.
Post by: marius-ciclistu on August 25, 2017, 10:38:04 pm
Search for osclass helpers that tell you if the page is for login etc.
Then, put your adsense code into an if statement.

Ex.

<?php if( !osc_is_login_form() ) { ?>

Ad  code

<?php } ?>

Helpers for location

osc_is_ad_page() - Get if user is on ad page
osc_is_search_page() - Get if user is on search page
osc_is_static_page() - Get if user is on a static page
osc_is_home_page() - Get if user is on homepage
osc_is_user_dashboard() - Get if user is on user dashboard
osc_is_publish_page() - Get if user is on publish page
osc_is_login_form() - Get if user is on login form
osc_get_osclass_location() - Get location
osc_get_osclass_section() - Get section
Title: Re: OSCLASS Ads management - Disable ads on Login, Register, Error Pages etc.
Post by: jimzubemo on August 25, 2017, 11:37:19 pm
Search for osclass helpers that tell you if the page is for login etc.
Then, put your adsense code into an if statement.

Ex.

<?php if( !osc_is_login_form() ) { ?>

Ad  code

<?php } ?>

Helpers for location

osc_is_ad_page() - Get if user is on ad page
osc_is_search_page() - Get if user is on search page
osc_is_static_page() - Get if user is on a static page
osc_is_home_page() - Get if user is on homepage
osc_is_user_dashboard() - Get if user is on user dashboard
osc_is_publish_page() - Get if user is on publish page
osc_is_login_form() - Get if user is on login form
osc_get_osclass_location() - Get location
osc_get_osclass_section() - Get section


Successfully tried for login page.
Will apply on other pages as well.

Thank you!
Title: Re: OSCLASS Ads management - Disable ads on Login, Register, Error Pages etc.
Post by: marius-ciclistu on August 25, 2017, 11:48:11 pm
You can put || in that if and put another contition and so on, meaning OR.

And you can put solved in the topic's title.
Title: Re: OSCLASS Ads management - Disable ads on Login, Register, Error Pages etc.
Post by: Aficionado on August 26, 2017, 12:23:09 am
Just keep in mind that if you have an old and well established website, all those don't matter. You can put ads everywhere you want.

Title: Re: OSCLASS Ads management - Disable ads on Login, Register, Error Pages etc.
Post by: jimzubemo on August 26, 2017, 09:20:55 pm
Just keep in mind that if you have an old and well established website, all those don't matter. You can put ads everywhere you want.

Not that established  :D
Don't want to risk getting banned by Google Adsense. Things may look alright but suddenly they may ban.  :o

Anyway, thanks for the help and suggestions.
Title: Re: OSCLASS Ads management - Disable ads on Login, Register, Error Pages etc.
Post by: Aficionado on August 26, 2017, 09:51:29 pm
Just keep in mind that if you have an old and well established website, all those don't matter. You can put ads everywhere you want.

Not that established  :D
Don't want to risk getting banned by Google Adsense. Things may look alright but suddenly they may ban.  :o

Anyway, thanks for the help and suggestions.

What i mean is, for example: If you put ads in your search results AND your search results are EMPTY, then you MIGHT have a problem. If you have plenty of results ( a busy site with lots of ads) then probably you are ok.

Google doesn't like much Classified ads sites, for one reason: Thin (little) content. But it is the nature of such site. So try not to have pages than have .... only google ads and no content (other than the menus etc).

good luck !
Title: Re: [SOLVED]OSCLASS Ads management - Disable ads on Login, Register, Error Pages etc
Post by: mrtsoftware on September 07, 2017, 06:12:15 pm
Untill now, I did not read and heard about GOOGLE was banned an ads website just due tue having login, register etc. page.
Google looks your content / number of visitors / site traffic and adsense RPM values...

No worry if you have a site which has good organic traffic.
Title: Re: [SOLVED]OSCLASS Ads management - Disable ads on Login, Register, Error Pages etc
Post by: muratbora on August 31, 2018, 05:39:11 pm
jimzubemo@
I could not manage to block showing adsense ads on /user/login, user/register, contact  pages...
Can you please help me how to implement this?

Today GOOGLE sent me violation report regaring showing ads on login, register, contact pages...
Title: Re: [SOLVED]OSCLASS Ads management - Disable ads on Login, Register, Error Pages etc
Post by: jimzubemo on September 27, 2018, 10:48:06 pm
The following code checks if it is login page or register page:

<?php if( !( osc_is_login_form() || osc_register_account_url() )  ) {?>

[ad code]

<?php } ?>

Depending on your theme, you need to find where or on which file the ad codes appear and use the condition above.
Title: Re: [SOLVED]OSCLASS Ads management - Disable ads on Login, Register, Error Pages etc
Post by: Aficionado on October 03, 2018, 12:47:19 am
The following code checks if it is login page or register page:

<?php if( !( osc_is_login_form() || osc_register_account_url() )  ) {?>

[ad code]

<?php } ?>

Depending on your theme, you need to find where or on which file the ad codes appear and use the condition above.

Not sure if this

Code: [Select]
<?php if( !( osc_is_login_form() || osc_register_account_url() )  ) {?>
is correct and working. The register part.
Title: Re: [SOLVED]OSCLASS Ads management - Disable ads on Login, Register, Error Pages etc
Post by: WEBmods on October 03, 2018, 12:11:41 pm
The following code checks if it is login page or register page:

<?php if( !( osc_is_login_form() || osc_register_account_url() )  ) {?>

[ad code]

<?php } ?>

Depending on your theme, you need to find where or on which file the ad codes appear and use the condition above.

Not sure if this

Code: [Select]
<?php if( !( osc_is_login_form() || osc_register_account_url() )  ) {?>
is correct and working. The register part.

Hello,

From the documentation, this is what the osc_register_account_url() function does:

osc_register_account_url() - Create automatically the url to register an account

I believe it can be replaced with Params::getParam('page') == 'register'.

Regards-
Title: Re: [SOLVED]OSCLASS Ads management - Disable ads on Login, Register, Error Pages etc
Post by: muratbora on December 09, 2018, 11:08:04 pm
I really could not manage to disable adsense ads for user-login.php

I use only adsense auto ads code placed into header.php, that's way it is showing ads wherever google wants.

Here osclasswizards theme user-login.php codes, please can you customize code where it disable adsense ads indicating?

<?php
    //

    // meta tag robots
    osc_add_hook('header','osclasswizards_nofollow_construct');

    osclasswizards_add_body_class('login');
   
    osc_current_web_theme_path('header.php');
?>

<div class="row">
  <div class="col-lg-4 col-md-7" id="user-login">
    <div class="wraps">
      <div class="title">
        <h1>
          <?php _e('Please Login', OSCLASSWIZARDS_THEME_FOLDER); ?>
        </h1>
      </div>
      <form action="<?php echo osc_base_url(true); ?>" method="post" >
        <input type="hidden" name="page" value="login" />
        <input type="hidden" name="action" value="login_post" />
        <div class="form-group">
          <label class="control-label" for="email">
            <?php _e('E-mail', OSCLASSWIZARDS_THEME_FOLDER); ?> <sup>*</sup>
          </label>
          <div class="controls">
            <?php UserForm::email_login_text(); ?>
          </div>
        </div>
        <div class="form-group">
          <label class="control-label" for="password">
            <?php _e('Password', OSCLASSWIZARDS_THEME_FOLDER); ?> <sup>*</sup>
          </label>
          <div class="controls">
            <?php UserForm::password_login_text(); ?>
          </div>
        </div>
        <div class="form-group">
          <div class="controls checkbox">
            <?php UserForm::rememberme_login_checkbox();?>
            <label for="remember">
              <?php _e('Remember me', OSCLASSWIZARDS_THEME_FOLDER); ?>
            </label>
          </div>
        </div>
        <div class="form-group">
          <div class="controls">
        <p><?php osc_run_hook("anr_captcha_form_field"); ?></p>
            <button type="submit" class="btn btn-success">
            <?php _e("Log in", OSCLASSWIZARDS_THEME_FOLDER);?>
            </button>
          </div>
        </div>
        <div class="actions"> <a href="<?php echo osc_register_account_url(); ?>">
          <?php _e("Register for a free account", OSCLASSWIZARDS_THEME_FOLDER); ?>
          </a><br />
          <a href="<?php echo osc_recover_user_password_url(); ?>">
          <?php _e("Forgot password?", OSCLASSWIZARDS_THEME_FOLDER); ?>
          </a> </div>
      </form>
    </div>
  </div>
</div>
<?php osc_current_web_theme_path('footer.php') ; ?>