WordPress.org

Ready to get started?Download WordPress

Forums

Adsense only on category sidebar (7 posts)

  1. Jeronsdc
    Member
    Posted 2 years ago #

    Hi.

    Im having no luck on getting my adsense to appear on the sidebar only on the category pages.

    Does anyone know how?

    Thanks!

  2. Jeronsdc
    Member
    Posted 2 years ago #

    Nobody?

  3. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    can you describe what you have tried so far?

    are you hardcoding the adsense in the sidebar?
    then try http://codex.wordpress.org/Function_Reference/is_category

    are you using a textwidget with the adsense code?
    then try to use a plugin such as 'widget-logic' http://wordpress.org/extend/plugins/widget-logic/

  4. Jeronsdc
    Member
    Posted 2 years ago #

    Im hardcoing adsense in the sidebar, this is what im doing:

    <?php
    if ( !theme_dynamic_sidebar( 'default' ) ) : ?>
    <?php $style = theme_get_option('theme_sidebars_style_default'); ?>

    <?php ob_start();?><?php
    echo theme_get_menu(array(
    'source' => theme_get_option('theme_vmenu_source'),
    'depth' => theme_get_option('theme_vmenu_depth'),
    'class' => 'art-vmenu'
    )
    );
    ?>
    <?php theme_wrapper('vmenu', array('title' => __('Vertical Menu', THEME_NS), 'content' => ob_get_clean())); ?>

    <?php ob_start();?>
    <?php get_search_form(); ?>
    <?php theme_wrapper($style, array('title' => __('Search', THEME_NS), 'content' => ob_get_clean())); ?>

    <?php ob_start();?>

      <?php wp_list_categories('show_count=1&title_li='); ?>

    <?php theme_wrapper($style, array('title' => __('Categories', THEME_NS), 'content' => ob_get_clean())); ?>

    <?php endif; ?>

    <?php is_category( $category ); ?>

    <script type="text/javascript"><!--
    google_ad_client = "?????";
    /* Publicidad categorias */
    google_ad_slot = "?????";
    google_ad_width = 160;
    google_ad_height = 600;
    //-->
    </script>
    <script type="text/javascript"
    src="http://pagead2.googlesyndication.com/pagead/show_ads.js">
    </script>

    My theme was created with Artisteer and my category pages are an archive.php file. If tried putting <?php is_archive(); ?> but it doesnt work.

  5. alchymyth
    The Sweeper & Moderator
    Posted 2 years ago #

    you need to use a conditional statement http://php.net/manual/en/control-structures.if.php

    the section should look like:

    <?php if( is_category() ) { ?>
    
    <script type="text/javascript"><!--
    goog...
    ...
    ..._ads.js">
    </script>
    
    <?php } ?>
  6. Jeronsdc
    Member
    Posted 2 years ago #

    It worked, THANKS!

  7. sai krishna
    Member
    Posted 2 years ago #

    thank you alchymyth

Topic Closed

This topic has been closed to new replies.

About this Topic