Some users of of arthemia theme would like to display pages instead of categories in the category bar of this theme.
This bar has a custom styling for each of the 5 categories displayed.
What we are going to do is take off the list of categories and replace this list with a list of pages.
The bar is created in index.php of arthemia theme and I refer to this file with the given styling.
From line 52 to line 70 (if unmodified) you find:
<div id="middle" class="clearfloat">
<img src="<?php echo get_option('home'); ?>/wp-content/themes/arthemia/images/category.png" class="clearfloat" alt="" />
--------------
All stuff in here we are replacing by the code given below!!
The image category.png you can change to what you like or remove this whole line too
--------------
</div>
<?php } ?>
<div id="bottom" class="clearfloat">
Let’s come to the replacement:
We insert this:
<?php
$pages = get_pages(); $i = 1;
foreach ($pages as $page) { ?>
<div id="cat-<?php echo $i; ?>" class="category">
<span class="cat_title"><a href="<?php echo get_page_link($page->ID) ?>"><?php echo $page->post_title ?></a></span>
</div>
<?php $i++; } ?>
to call all pages and give them the style of the categories we had before.
Now it could be you have more than 5 pages or you do not want to display some of them. I suggest using the ‘include’ parameter and include exactly 5 of your pages.
The second line of this code could look like this:
$pages = get_pages('include=2,41,42,132,134'); $i = 1;
here I included the pages with IDs of 2 and 41 etc, just five of them to fit in
To list subpages or even excerpt of that pages – there is sure a way…
Update to get a description like there is a description for categories in this theme:
To get a description for each page we show in the category bar of arthemia we use a custom field as you have to use for images in posts.
Edit your pages where you want to get a short description and scroll in page editor down to ‘Custom Fields’
In “Add a new custom field:” under Key you enter ‘ pagedesc ‘ (just eight letters, no hyphen) and under Value any text you like to have as description for that page.
To be able to see this description you have to insert an updated code, actually same as above but with a query for this new created field and a command to echo it if it is there:
Full updated code here:
<?php
$pages = get_pages('include=2,41,42,132,134'); $i = 1;
foreach ($pages as $page) { ?>
<div id="cat-<?php echo $i; ?>" class="category">
<span class="cat_title"><a href="<?php echo get_page_link($page->ID) ?>"><?php echo $page->post_title ?></a></span>
<?php if(get_post_meta($page->ID, "pagedesc", true)){ ?>
<a href="<?php echo get_page_link($page->ID) ?>"><?php $key="pagedesc"; echo get_post_meta($page->ID, $key, true); ?></a>
<?php } ?>
</div>
<?php $i++; } ?>
happy coding, give a comment if it is not working…
Another update: Sort the page entries as you like:
insert in this line:
$pages = get_pages('include=2,41,42,132,134'); $i = 1;
the parameter &sort_column=menu_order like this:
$pages = get_pages('include=2,41,42,132,134&sort_column=menu_order'); $i = 1;
then adjust in edit page on the right side under ‘order’ to give a value like first page in that row give 2, second one 4 third the 6,
it’s just like playing games as you have to try.
arthemia category bar Hi everyone I recently installed Arthemia on my WP site and need to make a couple of changes. Can anyone help with this: 1.) How do I move the category bar up so that it then it simply shows the latest post but this post gets replicated right under the categories bar. I changed the code in Arthemia to hide all posts from the Headline category in In the middle of the front page has a nice blue and black which will help your readers exploring you site. At the bottom is outfitted with a blog http://michaelhutagalung.com/2008/05/ magazine blog Januar 2011 : Linkverzeichnis WP Older: 01.03 WordPress Admin Plugins 01.12 Links zum Start in Tags: wordpress, theme, arthemia, Putting pages in the was explained here a while ago: http://webdesign.go41.de/wordpress tips/list pages custom styling in /
Search terms:
- arthemia make category bar pages
- arthemia premium pages bar
- how to add categories to your search bar description
February 3, 2009 um 10:15 Uhr
Thank you very very much! That´s fantastic!
February 3, 2009 um 12:53 Uhr
Sorry, ich nerve bestimmt schon^^
WP ordnet die Seiten in der Category-Bar automatisch nach alphabet. Egal in welche Reihenfolge ich die Seite eintrage und egal welche ID ich in der Index.php zuerst nenne.
Kann man da noch etwas machen?
February 7, 2009 um 18:56 Uhr
Exactly what I’ve been struggling with – thanks so much for taking the time to write this tutorial.
Here is the final project: http://www.bipolarscotland.org.uk
May 22, 2009 um 23:01 Uhr
Hi.
Can You help me, how to modify header.php or css for:
PAGE 1
- SUB PAGE1
– SS PAGE of SUB PAGE1
– SS PAGE of SUB PAGE1
- SUB PAGE2
– SS PAGE of SUB PAGE1
– SSS PAGE of SUB PAGE1
- SUB PAGE3
PAGE 2
PAGE 3
SS Pages is not showed in main navbar in header
August 13, 2009 um 00:24 Uhr
How do I sort out the colours for the category, for some reason mine do not work correctly. (I have used the above code exactly in Arthemia Premium).
August 15, 2009 um 11:25 Uhr
@VP
Arthemia Premium is working quite different to the free Arthemia version. For the Premium you get full support on Michaels site – if you paid for your theme
September 16, 2009 um 13:52 Uhr
My site is http://www.helpmagazine.org.uk and I’ve managed to get the latest post into the category bar (with the excerpt). I would like to put the latest post of each page/category their and I was wondering how to do so. The code is a mixture of the code you’ve got and my own created code. It can be found below:
<div id="cat-” class=”category”>
<a href="ID) ?>”>post_title ?>
ID, “pagedesc”, true)){ ?>
3,
‘category__not_in’ => array(11,12),
‘showposts’ => 1,
));
?>
<a href="” rel=”bookmark” title=”Permanent Link to “>
<img src="/”
alt=”" class=”left” width=”130px” height=”90px” />
ID;
$the_content =$wpdb->get_var(“SELECT post_content FROM $wpdb->posts WHERE ID = $id”);
$pattern = ‘!
<a href="” rel=”bookmark” title=”Permanent Link to “>
<img src="/”
alt=”" class=”left” width=”100px” height=”65px” />
<a href="” rel=”bookmark” class=”title”>
–
<a href="ID) ?>”>ID, $key, true); ?>
IF YOU COULD PLEASE HELP ME, THEN THAT WOULD BE MOST APPRECIATED.
THANK YOU JOERN
VP
September 16, 2009 um 13:54 Uhr
THIS IS THE FULL CODE:
<div id="cat-” class=”category”>
<a href="ID) ?>”>post_title ?>
ID, “pagedesc”, true)){ ?>
3,
‘category__not_in’ => array(11,12),
‘showposts’ => 1,
));
?>
<a href="” rel=”bookmark” title=”Permanent Link to “>
<img src="/”
alt=”" class=”left” width=”130px” height=”90px” />
ID;
$the_content =$wpdb->get_var(“SELECT post_content FROM $wpdb->posts WHERE ID = $id”);
$pattern = ‘!
<a href="” rel=”bookmark” title=”Permanent Link to “>
<img src="/”
alt=”" class=”left” width=”100px” height=”65px” />
<a href="” rel=”bookmark” class=”title”>
–
<a href="ID) ?>”>ID, $key, true); ?>
April 14, 2011 um 11:30 Uhr
Hi,
I would like to have a combination of categories AND pages in my category bar. How would I do that?
Preferbly 4 categories and 1 page (at the end of the bar).
Help would be so much appreciated!!
Thanks,
Annemieke
April 14, 2011 um 12:35 Uhr
@Annemieke
pls find an answer here:
combination of categories AND pages in arthemia category bar
July 14, 2011 um 18:33 Uhr
Hallo!
Schönes Tutorial – ich hoffe, das geht auch auf deutsch…
Ich versuche in meiner Arthemia Premium Edition die Seiten in die Category Bar zu bringen – bisher leider erfolglos.
Gibt`s es dazu auch einen Anleitung? Ich finde noch nicht einmal die entsprechenden Codes in index.php oder header.php.
Das sieht in der Premium alles ganz anders aus.
July 14, 2011 um 20:05 Uhr
Arthemia Premium Edition ist schon ganz anders aufgebaut, da ist das in header.php unter
div id=”middle” class=”clearfloat”
in den Zeilen die div id=”cat- folgen…
wenn man alles in div id=”middle” ersetzt, geht das wohl, nur kann man dann im dashboard nichts mehr (vor)auswählen …
für Fragen gibt’s ein Forum: http://forum.go41.de/
July 14, 2011 um 21:00 Uhr
OK, danke – ich glaube, ich bin auf dem richtigen Weg. Super Anleitung, danke nochmals. Es klappt damit wohl auch mit der Premium Edition…
December 8, 2011 um 15:42 Uhr
Any idea how to put a photo for each category instead of a description? I currently have the most recent photo for each category but would prefer a static photo instead. Any help is much appreciated!
December 8, 2011 um 16:52 Uhr
got an idea..
you use arthemia premium and I guess you modified in header.php this line:
<p><a href="<?php echo get_category_link($cp_pC);?>"><?php echo category_description($cp_pC); ?></a></p>
to some code to show an image in this new div class=”clearfloat”
you could now replace this img src with a code echoing the cat ID with the image extension .jpg
the echo for cat-ID you do already as I can see in source code:
div id=”cat-24″ class etc
this cat-24 is created by the part: … ?php echo $cp_pC; ? …
use for example:
<img src="your-uploads/directory/<?php echo $cp_pC; ?>.jpg" />
to get: img src=”your-uploads/directory/cat-24.jpg” printed in source code of your site.
you need now 5 images in this your-uploads/directory with a name according to your categories (cat-37.jpg cat-7.jpg cat-24.jpg cat-221.jpg cat-241.jpg)
SORRY IF CODE COMES OUT BAD, I SWITCHED THE THEME HERE AND USE CODE THE FIRST TIME.
please use my http://forum.go41.de/ for any more questions, okay?
- I get hungry now
Jörn