How to ad a blog to WPESP theme
-
I have had so many email asking me how I have managed to create a blog inside my WPESP theme. So I figured I could write how I did it here and hopefully don’t have to reply to every email.
When I worked with WPESP theme I was a noob at php. So the solution I have used may not be the best, but use it if you see it fit.
In my wordpress dashboard I created a category called “Blogg” with the slug named “osv”. I then created several undercategories which was intended to be all of my blog categories. I named them with the subject I was going to write about, but I also named the slugs “cat1”, “cat2” and so forth.
Then I wrote this code into my index.php:
<?php if (is_category('osv') or is_archive()): include(TEMPLATEPATH . '/category-blogg.php'); elseif( in_category(array( 'osv', 'cat1', 'cat2', 'cat3', 'cat4', 'cat5', 'cat6', 'cat7'))) : include(TEMPLATEPATH . '/blogg.php'); endif ?>
As you can see I assigned one template to be used when all of the posts in the category “osv” was listed, and then another one when clicking on one of the posts inside “osv” or some of the subcategories under “osv”. This is because I wanted the blogg too look different from the category “work”.
Then I wrote this code in my header.php to ad the blogg button:
<a <?php if ( is_category('osv') ) { ?> class="active"<?php } ?> href="<?php echo get_option('home'); ?>/osv" title="Tanker og funderinger">BLOGG<small>Osv.</small></a>
In my sidebar I added this code to limit the category listings so that the portfolio would not show:
<?php wp_list_categories('orderby=name&show_count=1&title_li=<h3>Kategorier</h3>&exclude=4&child_of=6'); ?>
Exclude 4 means that the work category will not be listed. child_of=6 means that it should only show the subcategories of the category 6 (which is the “osv” category)
And exclude category 4 (work) from the archive:
<?php wp_get_archives('cat=-4'); ?>
Hope this will help people.
Cheers from Aich & Mokie
- The topic ‘How to ad a blog to WPESP theme’ is closed to new replies.