Archived

This topic is now archived and is closed to further replies.

  • 0

custom category template

Question

Posted · Report post

Hi there again, First, thanks for all the support up to this point! You've been very kind. For www.aequator.goedgehost.nl, I want to setup a custom template for four specific categories ("water", and three others.). If I know how to create one, the rest will probably be copy-paste work. This is what I've done so far: 1) I have created category-water.php and put it in the Platform Base theme folder. It seemed to work (at least I got an empty page when I was in the category water) 2) Then I added this code:

<?php
	if(VPRO) {
	/*
	Template Name: Water
	*/
	
	// Get Control Template
	get_template_part( 'template.load' );
	
	}
	?>
The problem is that when I load the Template Mapping of Platform Pro by get_template_part( ' template.load' );, it forgets everything else and it is not 'custom' anymore. 3) I've also added this:
						'Water' => array(
									'name'			=> 'Water',
									'sections' 		=> array( 'PageFeatures', 'PageLinesBoxes' ),
								),

to config.templates.php in platformpro/config. The "Water" template shows up in the platform pro template options, and I can rearrange stuff, but nothing changes. It seems that the posts page layout (because it is a category page) overrides the category-water.php. In this specific category page, I want: - a feature slider, but then with other photo's then the home page feature slider (which is another problem) - a welcome message (a post perhaps?) - an overview of posts from this category - the normal widgets I have on every page (most used tags and most used categories) I hope you can help me. If you have any questions, please ask! greetings, Lars

Share this post


Link to post
Share on other sites

13 answers to this question

Posted · Report post

Oh ok, sorry about that. I think only Andrew can answer this question for now as he's obviously the most intimate with the product. I'll shoot him an email to see if he's ready to release this feature yet.

Share this post


Link to post
Share on other sites

Posted · Report post

I'm considering hardcoding conditionals into section.features.php. (Yes I know the code is totally wrong, it's just a draft) Draft:

If (category is 18, 9, 16 or 15)
	
	feature_source = 'featureposts'
	feature_nav_type = 'nonav'
	feature_default_tax = $current_category_slug
	feature_stageheight = '200'
	
	elseif (page=home)
	
	feature_source_'posts'
	feature_nav_type = 'names'
	feature_stageheight = '330'
	
	elseif (other category)
	do nothing, die an agonising death and not show feature slider

But I don't know how to start all this. I probably don't even need to hardcode. Please help?! Where can I edit some code to set these feature settings only on these 4 categories? Any help would be appreciated.

Share this post


Link to post
Share on other sites

Posted · Report post

I've tried creating custom templates as well, but never could get the "content" to stick. It says it saves the sections, but never does. I never could get it to work right.

Share this post


Link to post
Share on other sites

Posted · Report post

Thanks Cmunns, for all the help sofar. It's not really a feature request, but more the question of why it's not saving, as Mark mentions.

Share this post


Link to post
Share on other sites

Posted · Report post

Hey cmunns, Actually I have a feeling I know what to do. As I explained before, WordPress has a category hierarchy (to decide which template it uses first): 1. category-slug.php (Note: available with Version 2.9) 2. category-ID.php 3. category.php 4. archive.php 5. index.php That's why I created category-water.php. This really works, because it showed an empty page when in the category water. But when I added this code (which you use in your platform pro templates):

get_template_part( 'template.load' );
	

But then the WordPress hierarchy is gone. It then just loads the Platform Pro theme-mapper to map the template. What I then tried to circumvent this issue, I tried making a 'custom template' within the Platform Pro framework by extending the array (as described above) in config.templates.php in platformpro/config. It then shows up in the Platform Pro frontend template layout editor. However, everything I then add to the template, doesn't show up. That's where I'm currently stuck. I need some basic insight in how your template map works, or understand what code I have to change in order to make my 'custom template' solution work. Thanks for the suggestion, cmunns, but it seems that this plugin doesn't really have an answer to my problem.

Share this post


Link to post
Share on other sites

Posted · Report post

Anyone?

Share this post


Link to post
Share on other sites

Posted · Report post

You may need to follow the structure of the page templates that go like this page.alpha.php, page.beta.php page.alpha.php refers to this code ` <?php if(VPRO) { /* Template Name: Feature Page */ setup_pagelines_template(); } ?> ` which you can see is the PageLines Feature Page (a custom template) Of course you'd still have to add to the config.templates.php file as before but in a different location than I think you trying before?

Share this post


Link to post
Share on other sites

Posted · Report post

You will have problems putting two features on one page, but if you want to add special items to category pages why don't you use hooks to insert what you want? OR is that sloppier because you need to hide a lot of the current info as well?

Share this post


Link to post
Share on other sites

Posted · Report post

Andrew?

Share this post


Link to post
Share on other sites

Posted · Report post

I dont want two features, just one. But it does use a different source for the featureslider. Which hooks should I use? In what file? And how? So how do I create a template that combines a feature page, an introductory text, and a blog posts layout?

Share this post


Link to post
Share on other sites

Posted · Report post

Yes, that's what I've done (as described above). The only difference with your example is that you're using 1.22 and I'm using 1.04. I use this:

get_template_part( 'template.load' );
	
You use this:
setup_pagelines_template();
	
Which boils down to the same function:
function setup_pagelines_template() {
		get_template_part( 'template.load' );
	}

But still, as I've mentioned before, the template I've created does show up in the template layout editor, but any changes I make in there don't seem to be saved and applied to the category. Even if I set a page to this template, nothing happens.

Share this post


Link to post
Share on other sites

Posted · Report post

More support coming. Thanks, Bryan

Share this post


Link to post
Share on other sites