Jump to content
Sign in to follow this  
glevine

Custom Template for homepage

Recommended Posts

glevine

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!

Share this post


Link to post
Share on other sites
cmunns

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?

Share this post


Link to post
Share on other sites
glevine

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.

Share this post


Link to post
Share on other sites
bryan-hadaway

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: http://www.pagelines.com/docs/changing-colors-fonts http://www.w3schools.com/css/ Thanks, Bryan

Share this post


Link to post
Share on other sites
glevine

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!

Share this post


Link to post
Share on other sites
cmunns

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.

Share this post


Link to post
Share on other sites
glevine

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?

Share this post


Link to post
Share on other sites
catrina

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: http://www.pagelines.com/docs/custom-sections


Please read the docs before posting. Please do not private message me unless I ask you to.

Designer | Catrina Dulay

Founder | Catrina and Mouse

Share this post


Link to post
Share on other sites
glevine

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

Share this post


Link to post
Share on other sites
cmunns

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?

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now

Sign in to follow this  

×