How to insert a banner in a Wordpress Category results page

Discussion in 'WordPress' started by kokiwebs, Nov 4, 2010.

  1. #1
    Hi

    I have to insert a banner at the top of a Wordpress Category results page but I don't know how to. I have searched in this and other forums, in google, and nothing. Can anyone please give me step-by-step instructions? I don't know much coding, in fact almost nothing. I am aware that I cannot insert it in a page thus it is probable that I might have to change the index.php file, or maybe the stylesheet, and call for action?

    Thanks a lot.
     
    kokiwebs, Nov 4, 2010 IP
  2. JT706

    JT706 Peon

    Messages:
    272
    Likes Received:
    3
    Best Answers:
    0
    Trophy Points:
    0
    #2
    You will need to be able to edit the archive.php file under Appearances--->Editor--->archive.php

    Place the link to your banner image just under the call to Header.php and see if that works.
     
    JT706, Nov 4, 2010 IP
  3. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #3
    If you are using the default TwentyTen theme, open twentyten/category.php

    Place an image element for the banner at line 14, just before the main heading:
    
    			<div id="content" role="main">
                                    [COLOR="blue"]<img src="BANNER-URL" alt="ALT-TEXT" /> [/COLOR]
    				<h1 class="page-title">
    
    Code (markup):
     
    Cash Nebula, Nov 4, 2010 IP
  4. kokiwebs

    kokiwebs Greenhorn

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #4
    What code would you need to see? Archive php? I am not using twenty ten, unfortunately, otherwise it would be solved. My site has several categories, and the banner would have to appear in one of them only. The website is maitravelsite.com , and the banner would have to be placed in the "Americas " category. Thanks for helping...
     
    Last edited: Nov 4, 2010
    kokiwebs, Nov 4, 2010 IP
  5. kokiwebs

    kokiwebs Greenhorn

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #5
    Hi all

    Just wanted to say thanks. With the tips you have given me I have been able to try it out and mission accomplished. EDIT

    The banner now shows in all categories, I only need it to appear in one of them. Is this possible? As of now, it appears in all or in none at all.
    This is part of the archive.php code. You can see where I have palced the link for the banner to appear, but I want to limit it to 1 category

    I will add the code in a new reply
     
    Last edited: Nov 4, 2010
    kokiwebs, Nov 4, 2010 IP
  6. kokiwebs

    kokiwebs Greenhorn

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #6
    This is part of the code for the archive.php file, where you can see where I placed the link.

    <?php get_header(); ?>
    <div class="span-24" id="contentwrap">
    <div class="span-16">
    <div id="content">

    <?php if (have_posts()) : ?>

    <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
    <?php /* If this is a category archive */ if (is_category()) { ?>
    <h2 class="pagetitle">Search Results for the &#8216;<?php single_cat_title(); ?>&#8217; Category</h2>
    <p style="text-align: center;"><a href="http://www.florida4less.co.uk"><img class="aligncenter size-full wp-image-3140" title="Florida holidays 2011 - Florida4Less" src="http://www.maitravelsite.com/wp-content/uploads/2010/01/468x60-v21.jpg" alt="Florida holidays 2011 - Florida4Less" width="468" height="60" /></a></p>
    <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
    <h2 class="pagetitle">Posts Tagged &#8216;<?php single_tag_title(); ?>&#8217;</h2>
    <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
    <h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2>
    <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
    <h2 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h2>
    <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
    <h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>
    <?php /* If this is an author archive */ } elseif (is_author()) { ?>
    <h2 class="pagetitle">Author Archive</h2>
     
    kokiwebs, Nov 5, 2010 IP
  7. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #7
    Yes, insert another category test just before the banner, but this time add a category value inside the brackets. The parts in blue are the my additions.
    The value can be an ID number, title, or slug. If you use a title or slug, be sure to put quotes around the text.
    
    <?php get_header(); ?>
    <div class="span-24" id="contentwrap">
    <div class="span-16">
    <div id="content">
    
    <?php if (have_posts()) : ?>
    
    <?php $post = $posts[0]; // Hack. Set $post so that the_date() works. ?>
    <?php /* If this is a category archive */ if (is_category()) { ?>
    <h2 class="pagetitle">Search Results for the ‘<?php single_cat_title(); ?>’ Category</h2>[COLOR="blue"]
    <?php if (is_category(???)) { ?>[/COLOR]<p style="text-align: center;"><a href="http://www.florida4less.co.uk"><img class="aligncenter size-full wp-image-3140" title="Florida holidays 2011 - Florida4Less" src="http://www.maitravelsite.com/wp-content/uploads/2010/01/468x60-v21.jpg" alt="Florida holidays 2011 - Florida4Less" width="468" height="60" /></a></p>[COLOR="blue"]<?php } ?>[/COLOR]
    <?php /* If this is a tag archive */ } elseif( is_tag() ) { ?>
    <h2 class="pagetitle">Posts Tagged ‘<?php single_tag_title(); ?>’</h2>
    <?php /* If this is a daily archive */ } elseif (is_day()) { ?>
    <h2 class="pagetitle">Archive for <?php the_time('F jS, Y'); ?></h2>
    <?php /* If this is a monthly archive */ } elseif (is_month()) { ?>
    <h2 class="pagetitle">Archive for <?php the_time('F, Y'); ?></h2>
    <?php /* If this is a yearly archive */ } elseif (is_year()) { ?>
    <h2 class="pagetitle">Archive for <?php the_time('Y'); ?></h2>
    <?php /* If this is an author archive */ } elseif (is_author()) { ?>
    <h2 class="pagetitle">Author Archive</h2> 
    
    Code (markup):
     
    Last edited: Nov 5, 2010
    Cash Nebula, Nov 5, 2010 IP
  8. kokiwebs

    kokiwebs Greenhorn

    Messages:
    17
    Likes Received:
    0
    Best Answers:
    0
    Trophy Points:
    11
    #8
    Cash, thank you so much! It is exactly what I needed and it now shows how I needed it to be. Woohoo!! There is nothing like knowing what you're doing! Thank you very much again :)
     
    kokiwebs, Nov 5, 2010 IP
  9. Cash Nebula

    Cash Nebula Peon

    Messages:
    1,197
    Likes Received:
    67
    Best Answers:
    0
    Trophy Points:
    0
    #9
    Cash Nebula, Nov 5, 2010 IP