list pages custom styling in arthemia category bar
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.
Related posts:
- List subcategories in category bar of arthemia theme
In the WordPress theme Arthemia theme by Michael Jubel is... - List one latest post per category on frontpage view
I will give you here a code to list only... - List some pages with content in WordPress
To list pages in WordPress you normally take this: <?php... - Category view in Arthemia optimized
Question: Can you display headline & featured block to each... - Add Adsense between some Posts in WordPress
In WordPress on the frontpage you have normally a flow...
JW ist Freelance Webdeveloper
Website Questions? Please ask in Webdesign Forum
You can follow any responses to this entry through the
RSS 2.0 feed.
You can leave a response, or trackback from your own site.






Thank you very very much! That´s fantastic!
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?
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
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
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).
@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
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
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); ?>