WordPress.org

Support

Support » How-To and Troubleshooting » PHP code pls, i want to Show ad based on Category just after post?

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

  • 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 Orginal Single post before

    [code moderated – please follow the forum guidelines for posting code]

    Then i Have Removed this code

    <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 .

    [code moderated – please follow the forum guidelines for posting code]

Viewing 1 replies (of 1 total)
  • Use

    if(in_category('computer')){
     //your computer ads code here
    }elseif(in_category('mobile')){
     //your mobile ad code here
    }

    etc.

Viewing 1 replies (of 1 total)
  • The topic ‘PHP code pls, i want to Show ad based on Category just after post?’ is closed to new replies.
Skip to toolbar