Jump to content


Photo

custom category template


This topic has been archived. This means that you cannot reply to this topic.
13 replies to this topic

#1 aequator

aequator

    Advanced Member

  • Members
  • PipPipPip
  • 52 posts

Posted 24 January 2011 - 11:01 AM

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

#2 cmunns

cmunns

    Advocate

  • Members

  • 6537 posts

Posted 24 January 2011 - 07:39 PM

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?

#3 aequator

aequator

    Advanced Member

  • Members
  • PipPipPip
  • 52 posts

Posted 24 January 2011 - 11:08 PM

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?

#4 bryan-hadaway

bryan-hadaway

    Advocate

  • Members
  • PipPipPipPipPip
  • 3697 posts

Posted 25 January 2011 - 06:06 AM

More support coming. Thanks, Bryan

#5 aequator

aequator

    Advanced Member

  • Members
  • PipPipPip
  • 52 posts

Posted 25 January 2011 - 04:34 PM

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.

#6 aequator

aequator

    Advanced Member

  • Members
  • PipPipPip
  • 52 posts

Posted 25 January 2011 - 10:37 PM

Anyone?

#7 aequator

aequator

    Advanced Member

  • Members
  • PipPipPip
  • 52 posts

Posted 26 January 2011 - 07:59 AM

Andrew?

#8 cmunns

cmunns

    Advocate

  • Members

  • 6537 posts

Posted 26 January 2011 - 06:54 PM

I'm not entirely sure on this and I've been thinking about the best way to do it. I think in your case adding custom field data to category pages is the best way. Here is a resource I found to do that http://www.iamseo.or...ries-wordpress/

#9 aequator

aequator

    Advanced Member

  • Members
  • PipPipPip
  • 52 posts

Posted 27 January 2011 - 12:50 PM

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.

#10 cmunns

cmunns

    Advocate

  • Members

  • 6537 posts

Posted 27 January 2011 - 06:43 PM

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 ` ` 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?

#11 aequator

aequator

    Advanced Member

  • Members
  • PipPipPip
  • 52 posts

Posted 28 January 2011 - 10:01 AM

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.

#12 cmunns

cmunns

    Advocate

  • Members

  • 6537 posts

Posted 28 January 2011 - 09:00 PM

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.

#13 makeylon

makeylon

    Super Member

  • Members
  • 232 posts

Posted 28 January 2011 - 09:50 PM

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.

#14 aequator

aequator

    Advanced Member

  • Members
  • PipPipPip
  • 52 posts

Posted 28 January 2011 - 10:22 PM

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.