This is searchable archive of our old support forums, which operated from 2012 - 2016. To find out how to get support for your current theme, please visit our support page.

Unique Category Pages

  • Creator
    Topic
  • #13643
    Herb Trevathan
    Participant

    Hey Jason,

    Do you have a link to support docs for building unique category page with WP Jumpstart?

    For example here: http://floridahalfwayhouses.org/ – I would like to have a different page banner for halfway houses, and another for detox centers etc…

    Since the builder is so easy to use I might just go crazy with category customization but I am not sure where to start. On other themes I simply make hard coded category archive pages and code the banners and then use the loop etc…, I am guessing with Jumpstart it is much easier.

    Any help or resource links would be greatly appreciated…

    Thank You

Viewing 4 replies - 1 through 4 (of 4 total)
  • Author
    Replies
  • #13653
    Jason Bobich
    Keymaster

    Hello,

    If the only thing different between the archive pages is the banner at the top, why not use one of the widget areas at the top? You could use the widget area manager at Appearance > Widget Areas to create multiple widget areas for the location at the top of the page.

    Or you could even just use the widget logic plugin for a single widget area:

    http://wordpress.org/plugins/widget-logic/

    [edit] — Below wouldn’t make sense in your situation because this would be for each individual post. Oops!

    If you wanted to actually include a different template part file for each category, you could do that too. You’d just make copes of the file content-archive.php to your child theme and name them like content-category-foo.php, content-category-bar.php.

    Then, this is one way you could include them from your child theme’s functions.php.

    function my_template_part( $part, $type ) {
    	if ( 'archive' == $type && is_category() ) {
    		$category = get_the_category();
    		$part = 'category-'.$category->slug;
    	}
    	return $part;
    }
    add_filter( 'themeblvd_template_part', 'my_template_part' );
    #13655
    Herb Trevathan
    Participant

    sounds good – I might do just that, I have some other category specific styles and might need a unique body class, and possible category icons but we need to finalize things.

    normally I would make a duplicate of the ‘archive.php’ and then name it ‘archive-detox.php’ (archive-$category.php) etc and wordpress loads that page automagically, then I can add specific code for that page or use php includes for ads etc…but with a framework the typical theme files are not there.

    Could I go into the framework and pull out the file, and then recreate the folder/file structure and accomplish an override like I typically do with a generic child theme?

    Hahaha now that I typed it out it kinda makes sense : ) would that work?

    Thanks for the help.

    #13660
    Jason Bobich
    Keymaster

    normally I would make a duplicate of the ‘archive.php’ and then name it ‘archive-detox.php’ (archive-$category.php) etc and wordpress loads that page automagically, then I can add specific code for that page or use php includes for ads etc…but with a framework the typical theme files are not there.

    This is just basic template hierarchy. You can do all this in your child theme the same way you would any other theme. Except note that what you want to name the files is “category-*.php” — There’s no “archive-*.php” in WordPress template hierarchy.

    http://codex.wordpress.org/images/1/18/Template_Hierarchy.png

    The theme uses archive.php for all archives, but you can defintely copy the theme’s archive.php and make a category.php file or category-whatver.php file out of it in your child theme.

    However, this is most likely going to give you a little more hassle in the future when you’re making updates. So if you can get away with adding this to a widget area and controlling it that way, it’s going to be a lot easier to manage in the future.

    #13744
    Herb Trevathan
    Participant

    sorry, hahaha, I have been buried in a news website with CPT’s used as categories we have been making archives to keep things moving…crazy stuff.

    thanks for the template hierarchy reference – that will be handy : )

    I will give the widget solution a good look, looks like I will be busy through January with workload so we’ll see where I get with this…

    Thank You

Viewing 4 replies - 1 through 4 (of 4 total)
  • You must be logged in to reply to this topic.