Hi.
Im having no luck on getting my adsense to appear on the sidebar only on the category pages.
Does anyone know how?
Thanks!
Hi.
Im having no luck on getting my adsense to appear on the sidebar only on the category pages.
Does anyone know how?
Thanks!
Nobody?
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/
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 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.
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 } ?>It worked, THANKS!
thank you alchymyth
You must log in to post.