• 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

Viewing 3 replies - 1 through 3 (of 3 total)
  • hey! ??
    this looks great!
    I was one of those asked you to how to make a blog inside thist theme.
    for temporary I figured out with a blog-in-blog plugin.
    And thanx again fot taking time to explain the steps.:)

    stptn

    Hey there,

    I also had emailed you concerning this. Thanks so much for the post, but I’m still having some problems. Can someone help me out?

    I’ve followed the directions – added a blog category with subcategories, copy/pasted the code into my index.php (with my info instead of yours), and pasted the code into header.php. Now the “Blog” button shows up, but all of my pages give me an error message now:

    Parse error: syntax error, unexpected $end in public_html/wp-content/themes/wpesp-portfolio/index.php on line 32

    I’m not sure where to go from here.
    I’m also not sure about the last part of your instructions – adding the code to your sidebar. I don’t have a sidebar.php, is this in the index.php file, or one of the others?

    Any help would be much appreciated!! My website is https://www.milescaldwell.com.

    -Miles

    Hey Miles, how did you manage to have separate “home” and “portfolio” pages? and also, how do you label some projects with the “new” tag? any help would really be appreciated!
    – Ainhoa

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘How to ad a blog to WPESP theme’ is closed to new replies.