Jump to content


Photo
- - - - -

Custom Template for homepage


  • Please log in to reply
9 replies to this topic

#1 glevine

glevine

    Member

  • Members
  • PipPip
  • 12 posts

Posted 16 March 2011 - 08:09 PM

I've tried a number of solutions that are mentioned in the forum for creating custom templates, but I haven't had any luck getting what I want out of them. I have a carousel that I only want to show on my homepage. But I want the homepage to be a typical posts page, like it is by default. I don't want the carousel to show up on the category pages (using the Post Pages template), but I want to allow for a carousel (or other) to be added to the Post Pages template if desired at a later time. So I figure that my best option is to create a new page and point WP to that page as my homepage. And that page should use a custom template that includes the carousel and the posts loop content area. Using PlatformBase, how can I create a template for a page that contains the post loop content area? Thanks!

#2 cmunns

cmunns

    Advocate

  • Members

  • 6537 posts
  • Country: Country Flag

Posted 16 March 2011 - 09:04 PM

I think creating a new page template with an additional loop is over thinking it. You could probably just do it as you had then hide the carousel with CSS on the category, tag, archive pages. Or is that a hack solution for you?

#3 glevine

glevine

    Member

  • Members
  • PipPip
  • 12 posts

Posted 16 March 2011 - 09:09 PM

It's a bit of a hack solution. But my main issue with it is that it prevents me from being able to show the carousel on category, tag, archive pages in the future. The css rules would always hide the carousel and thus limit my options. Or at least it would make it more difficult as I'd need to further hack the theme to display it.

#4 bryan-hadaway

bryan-hadaway

    Advocate

  • Members
  • PipPipPipPipPip
  • 3697 posts

Posted 17 March 2011 - 02:00 AM

CSS will actually make this very easy, there are a number of ways to hide things, for now we could show just on the homepage, very simple.

And later we could refine. For what you want right now all that we need is:

`
#carousel{display:none}
.home #carousel{display:inline}
`
Drop that in Custom Code > Custom CSS or base.css if you're using the Base.

If you're not already familiar with customization; check these links out:

Please Login or Register to see this Hidden Content


Please Login or Register to see this Hidden Content



Thanks, Bryan

#5 glevine

glevine

    Member

  • Members
  • PipPip
  • 12 posts

Posted 17 March 2011 - 01:54 PM

Right... but the problem with that is that #carousel is now hidden on all pages that are not the home page. So if I added a carousel to the single post template (or just a single post) or wanted a carousel to show on category pages, then those would be hidden. I would have to add css rules to display those. I'm just not a fan of going about it that way. A better solution to me is to replicate the posts page template in a custom template and then I can assign that template however I wanted. It would require no extra css, especially useful since I won't be the person maintaining this website going further. The more I can make manageable through the admin interface, the better. So, can it be done? Thanks!

#6 cmunns

cmunns

    Advocate

  • Members

  • 6537 posts
  • Country: Country Flag

Posted 17 March 2011 - 06:58 PM

The non-meta page handling is the next major improvement we plan to make so it should be easier, but for now the only solution aside from modifying the section.carousel.php file itself and creating those options for category pages, tag pages, etc. But, no I do not have a time frame on this release unfortunately...but it's something we are working on improving for you guys.

#7 glevine

glevine

    Member

  • Members
  • PipPip
  • 12 posts

Posted 18 March 2011 - 02:19 PM

Thank you for the explanation. I was already considering that option, so I just went ahead and did it as you said. I copied section.carousel.php into Base and added checkboxes to the admin for choosing which pages can include a carousel. Then I just added the proper control-statement around the carousel container <div> and it essentially does what I want. Although I'm happy with it, it's still not the absolute best solution in my mind. Just out of curiosity... I am able to create a new template. So it seems to me that I only need to figure out how the posts pages template uses the posts loop content area instead of the traditional content area. Unfortunately, all templates seem to only call the setup_pagelines_template() function. I haven't dived deep enough yet, but is it correct to assume that some property or function in the theme is determining which template should include which type of content area (and other areas)? I imagine that if I can figure out what is actually different about the way the posts pages template is set up, then I can apply the same to a new template without too much trouble. And that would give me a completely custom template like I'm looking for. At this point, I'm just wanting to break it down and know how it works, whether or not I need it :). Am I thinking about this the right way?

#8 catrina

catrina

    Advocate

  • Members
  • 12345 posts
  • LocationCalifornia
  • Country: Country Flag

Posted 18 March 2011 - 05:14 PM

but is it correct to assume that some property or function in the theme is determining which template should include which type of content area (and other areas)? - Yes, this is correct. :)

This might be helpful, as well:

Please Login or Register to see this Hidden Content



#9 glevine

glevine

    Member

  • Members
  • PipPip
  • 12 posts

Posted 18 March 2011 - 06:09 PM

Any chance you could point out which property is responsible? I feel like it is in config/config.templates.php, but I'm having a hard time figuring out which one it is. I would guess it has something to do with the pagelines_get_page_templates() function. But the "sections" in the arrays for "default", "posts" and "single" all contain "PageLinesContent". So I'm having trouble figuring out how "PageLinesContent" is used to decipher which type of content area to show. Furthermore, there is the pagelines_get_content_templates() function which references different content areas, but I'm not sure which function and is really responsible for what (besides where each is displayed in the admin interface). Thanks

#10 cmunns

cmunns

    Advocate

  • Members

  • 6537 posts
  • Country: Country Flag

Posted 18 March 2011 - 09:52 PM

Each section has a default settings array. Most times there is something in that ways `'workswith' => array('main'),` where 'main' and other template areas can be added. This is how sections are added to the various page templates. Did that answer your question?