PHP code pls, i want to Show ad based on Category just after post?

0 replies
Hi Warriors this is my first Ever post here,

Please Can someone tell me the Code how to show specific Banner ad under post on Specific category.
i.e. For a Computer blog, a keyboard banner ad shown under post in the "Latest keyboards" category, mouse banners ad shown under post in the "Latest Mouse" category, etc. Thanks.
My Original Single post before

<?php get_header();?> <?php global ; = get_post_meta(,"_heading_image",true); = get_post_meta(,"_bgtext_heading_position",true); = get_post_meta(,"_page_short_desc",true); ?> <!-- Page Heading --> <div id="page-heading"> <img src="<?php echo ? : get_template_directory_uri().'/images/page-heading1.jpg';?>" alt="" /> <div class="heading-text<?php if ( =="right") echo '-right';?>"> <h3> <?php = get_the_category(); = ->name; echo ; ?> </h3> <p><?php echo category_description(->cat_ID);?></p> </div> </div> <!-- Page Heading End --> <div class="clear"></div> <div class="center"> <!-- Main Content Wrapper --> <div class="maincontent"> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post();?> <h3><?php the_title();?></h3> <div class="metapost"> <span class="first"><?php echo __('Posted at ','ecobiz');?><?php the_time( get_option('date_format') ); ?></span> | <span><?php echo __('By ','ecobiz');?>: <?php the_author_posts_link();?></span> | <span><?php echo __('Categories ','ecobiz');?>: <?php the_category(',');?></span> | <span><?php comments_popup_link(__('0 Comment','ecobiz'),__('1 Comment','ecobiz'),__('% Comments','ecobiz'));?></span> </div> <div class="clear"></div> <?php the_content();?> <div class="navigation"> <div class="alignleft"><?php previous_post_link( '%link', '' . __( '←', 'Previous post link', 'ecoboz' ) . ' %title' ); ?></div> <div class="alignright"><?php next_post_link( '%link', '%title ' . __( '→', 'Next post link', 'ecobiz' ) ); ?></div> </div><!-- #nav-below --> <?php endwhile;?> <?php endif;?> <div class="clear"></div> <!-- Author Box Start //--> <?php = get_option('ecobiz_author_box');?> <?php if ( != "true") { ?> <div id="authorbox"> <div class="blockavatar"> <?php if (function_exists('get_avatar')) { echo get_avatar(get_the_author_meta('user_email'), '48'); }?> </div> <div class="detail"> <h4><?php echo __('About ','ebiz');?><a href="<?php the_author_meta('url') ?>"><?php the_author_meta('display_name'); ?></a></h4> <p><?php the_author_meta('description'); ?></p> </div> <div class="clear"></div> </div> <?php } ?> <!-- Author Box End //--> <div class="clear"></div> <?php = get_option('ecobiz_disable_comment'); ?> <?php if ( !="true") { comments_template('', true); } ?> </div> <!-- Main Content Wrapper End --> <?php wp_reset_query();?> <?php get_sidebar();?> <?php get_footer();?>

Then i Have Removed this code

Quote:
<div class="metapost"> <span class="first"><?php echo __('Posted at ','ecobiz');?><?php the_time( get_option('date_format') ); ?></span> | <span><?php echo __('By ','ecobiz');?>: <?php the_author_posts_link();?></span> | <span><?php echo __('Categories ','ecobiz');?>: <?php the_category(',');?></span> | <span><?php comments_popup_link(__('0 Comment','ecobiz'),__('1 Comment','ecobiz'),__('% Comments','ecobiz'));?></span> </div>
from my Single post because in SERP this shows
"Post by author, and there # comments"
and this Really Improve my SERF results
Now my current Single post is this .

<?php get_header();?> <?php global ; = get_post_meta(,"_heading_image",true); = get_post_meta(,"_bgtext_heading_position",true); = get_post_meta(,"_page_short_desc",true); ?> <!-- Page Heading --> <div id="page-heading"> <img src="<?php echo ? : get_template_directory_uri().'/images/page-heading1.jpg';?>" alt="" /> <div class="heading-text<?php if ( =="right") echo '-right';?>"> <h3> <?php = get_the_category(); = ->name; echo ; ?> </h3> <p><?php echo category_description(->cat_ID);?></p> </div> </div> <!-- Page Heading End --> <div class="clear"></div> <div class="center"> <!-- Main Content Wrapper --> <div class="maincontent"> <?php if (have_posts()) : ?> <?php while (have_posts()) : the_post();?> <h3><?php the_title();?></h3> <div class="clear"></div> <?php the_content();?> <div class="navigation"> <div class="alignleft"><?php previous_post_link( '%link', '' . __( '←', 'Previous post link', 'ecoboz' ) . ' %title' ); ?></div> <div class="alignright"><?php next_post_link( '%link', '%title ' . __( '→', 'Next post link', 'ecobiz' ) ); ?></div> </div><!-- #nav-below --> <?php endwhile;?> <?php endif;?> <div class="clear"></div> <!-- Author Box Start //--> <?php = get_option('ecobiz_author_box');?> <?php if ( != "true") { ?> <div id="authorbox"> <div class="blockavatar"> <?php if (function_exists('get_avatar')) { echo get_avatar(get_the_author_meta('user_email'), '48'); }?> </div> <div class="detail"> <h4><?php echo __('About ','ebiz');?><a>"><?php the_author_meta('display_name'); ?></a></h4> <p><?php the_author_meta('description'); ?></p> </div> <div class="clear"></div> </div> <?php } ?> <!-- Author Box End //--> <div class="clear"></div> <?php = get_option('ecobiz_disable_comment'); ?> <?php if ( !="true") { comments_template('', true); } ?> </div> <!-- Main Content Wrapper End --> <?php wp_reset_query();?> <?php get_sidebar();?> <?php get_footer();?>
#based #category #code #php #pls #post #show

Trending Topics