WordPress.org

Ready to get started?Download WordPress

Forums

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

  1. ellero
    Member
    Posted 2 years ago #

    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]

  2. nsathees
    Member
    Posted 2 years ago #

    Use

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

    etc.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags