Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Center area post/pages (http://forum.bytesforall.com/forumdisplay.php?f=32)
-   -   [SOLVED] How to have page title for category pages? (http://forum.bytesforall.com/showthread.php?t=8427)

JFG Jul 21, 2010 07:40 PM

[SOLVED] How to have page title for category pages?
 
Hi,

I would like to display the name of the category at the top of each category page, anyone know how I can do that?

Using Atahualpa 3.5.3

lmilesw Jul 21, 2010 09:09 PM

There is nothing built into Atahualpa for that but you could search the plugins at WordPress.org or try to figure out how to code something to put in the center column above the loop.

juggledad Jul 22, 2010 04:20 AM

You could also add some php to Ato->Style &edit CENTER COLUMN->Content ABOVE The LOOP to test if you are on a category page and if so, pump out the HTML to display the category name.

Take a look at the Wordpress codex or do a google search with 'wordpress is_category' to see how to use the conditional function

JFG Jul 23, 2010 08:49 AM

Thanks for your replies.

What I have done is this : added a center widget area, and through a php widget added this code :

PHP Code:

<?php if (is_category('Category A')) { ?>
<p>This is the text to describe category A</p>
<?php } elseif (is_category('Category B')) { ?>
<p>This is the text to describe category B</p>
<?php } else { ?>
<p>This is the text to describe all other categories</p>
<?php ?>

but it is not automatic and a bit lengthy

I also tried this code :

PHP Code:

<?php
foreach((get_the_category()) as $category) { 
    echo 
$category->cat_name ' '

?>


but this actually displays the names of all categories associated with the latest post on the category page - not what I want to do.

What would I have to modify in the second example to display the name of the category page currently being displayed and not refer to the posts excerpts shown on that page?

Any help much appreciated,

JF

JFG Jul 23, 2010 09:19 AM

Actually it was all more simple than the code in my last post.

So if anyone wants to do display the category name at the top of the category page, here's how I did it:


1. I added a center widget area in Atahualpa

2. I installed the PHP code plugin and Widget Logic plugin

3. I added a php widget in the center widget area with this code inside it : <?php single_cat_title(); ?>

and in that same widget, I added this condition in the Widget Logic box : is_category()

Voila!

Thanks to lmilesw and juggledad for pointing me in the right direction

JF


All times are GMT -6. The time now is 09:39 PM.

Powered by vBulletin® Copyright ©2000 - 2024, Jelsoft Enterprises Ltd.