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.
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.
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):
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...
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
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 ‘<?php single_cat_title(); ?>’ 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 ‘<?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>
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):
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
No trouble, kokiwebs If you want to find out more, the Wordpress Function Reference is a good place to start.