Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Atahualpa 3 Wordpress theme (http://forum.bytesforall.com/forumdisplay.php?f=2)
-   -   [SOLVED] Question About Multiple Page Templates in Atahualpa (http://forum.bytesforall.com/showthread.php?t=491)

RandallJHoward Feb 21, 2009 04:14 PM

[SOLVED] Question About Multiple Page Templates in Atahualpa
 
I helped a charity to install Atahualpa to be used on a site for a charity and, after working with many Wordpress themes over the years, was just blown away with the configurability of your theme. This is an amazing piece of work.

I have a question about how best to get multiple page templates.

What I'm trying to achieve is:
1. a website with many pages all sharing the same page template, with the website look
2. a blog linked off the top tool bar with the standard blog posts
3. and some Wordpress "pages" attached to that blog in #2, with more of the blog look

I know that recent Wordpress can also act as a CMS site and that you can have several "Page Templates" (e.g. page.php, blogpage.php). However, it appears I would lose the configurability of Atahualpa if I used this method, because I don't think it supports this multiple-page template feature.

Can you suggest a way to achieve what I want to do? Or, are there future plans to offer this.

Thanks for your suggestions.

Regards, Randall

Flynn Feb 21, 2009 07:41 PM

You can actually copy index.php to page.php, single.php etc... and then edit the appropriate files, i.e. page.php

RandallJHoward Feb 22, 2009 02:37 PM

So, if I do that, could you please clarify how having separate page templates interacts with all the configuration inherent in Atahualpa.

Is there a way for each page to have separate configuration parameters, or do all page templates share the same Atahualpa parameters? The reason I ask is that I suspect the main differences between the page templates would be things that could be set as configurable parameters and that would involve writing less CSS + PHP code to achieve the effect. This would also be good because it would likely be easier to manage during updates to your theme.

Flynn Feb 22, 2009 03:15 PM

I am not sure if I understood your question but perhaps you don't know that Wordpress has a built in template system:

Wordpress looks for a page.php if a "page" page is requested, and then for index.php. Atahualpa does not have a page.php by default, but if you make a copy of index.php as page.php and upload it, then WP will find it the next time a "page" page is requested and use the page.php to display a "page" page instead of the index.php.

Now many contents of your page.php would be redundant, for instance the queries "is this a page" because page.php is always going to be a page.

Copying index.php to page.php and editing that page.php would be ONE way (the usual way) to create a different layout or functionality for page pages.

But you could as well use index.php for everything (As done by Atahualpa) and add additional "if this is a page" or "if this is page XX" conditions into index.php to display things differently on page pages.

RandallJHoward Feb 22, 2009 03:26 PM

I see the confusion. I want to have TWO page templates. One for blog-related pages and the other for website-related pages. I know Wordpress currently supports that, as well as selection of which template is used in the WP editor. What I don't know is how well this will work with Atahualpa's own configuration.

Flynn Feb 22, 2009 03:45 PM

You can set the front page to be a static page as you already seem to know, and then you can see where you are at inside index.php with

PHP Code:

<?php if ( is_front_page() ) ?>
Stuff to display only on front page, i.e. domain.com/
<?php ?>

and
PHP Code:

<?php if ( is_home() AND !is_paged() ) ?>
Stuff to display only on homepage of blog posts, i.e. domain.com/blog/
<?php ?>

or
PHP Code:

<?php if ( is_home() ) ?>
 Stuff to display only on homepage of blog posts, 
including page 2, page 3... ,i.e. domain.com/blog/, 
domain.com/blog/page/2/, domain.com/blog/page/3/
 <?php ?>


Masselyn May 8, 2009 10:00 PM

Not sure if this belongs here, but it can't hurt to ask.

I'd like to bring this thread back to life because I am trying to create multiple page templates, but I am unsure about how to configure the attributes about each template separately. Basically I want the default (index.php) to be for all pages, but there are Shop pages that I want to be different. In the Theme Options I have set the index.php to have a fixed layout container height (800px). But, this does not work for my Shop pages...where I need the height to be fluid again. So, I went through creating a new page template (my-shop-template.php) and assigned it to my Shop page. Great, got that done!

The Shop page is now using a different template...but I think I am confused on how to go into Theme Options (or style.css) and alter the look of this new template without changing index.php look at the same time. I assume creating a new style.css file (style2.css?), that is called up only by my new page template (my-shop-template.php) would work...I just don't know exactly what line of code to change.

Am I making any sense?

:)

Flynn May 8, 2009 11:06 PM

If you want to style one page differently than others, through the theme options, you'd have to do this with CSS Inserts, and by addressing the HTML elements on that page through the class and ID that the <body> tag of every page gets.

body#body-page-13 div.post {
background: green;
color: white;
}

would make the post container background green with white font, on the page with the ID 13. You should be able to address every page element on every single page individually with this method.

Look into the source code of any browser rendered page to see the available classes and ID's

</head>
<body id="body-page-13" class="body-post body-page ...."

paul_williams Jul 1, 2009 09:10 AM

That's very useful!
And, is it possible to style a page according to category?

dmtompki Jul 17, 2009 12:35 PM

Wow, that is very flexible!

Flynn Jul 22, 2009 11:26 AM

Quote:

Originally Posted by paul_williams (Post 9435)
That's very useful!
And, is it possible to style a page according to category?


Yes, look into the source code to see which classes the body gets on the given page. On the "Uncategorized" category page it is
category-uncategorized

It does not include the categories of a post on its single post page though. Combining the WP body class with the Atahualpa body class is on the todo list. The WP body class is new since WP 2.8 but rather basic. In Atahualpa 3.4.2 only the WP body class is being used.

MatthiasHeil Jul 22, 2009 12:34 PM

I'm trying to get the Thread Twitter plugin http://fairyfish.com/2009/01/19/thread-twitter/ to work, but am stuck with step 5 of the installation notes stating "5. Build a WordPress page template, and add following function to the template: <?php thread_twitter(); ?>" - I've tried copying and renaming Atahualpa's index.php to page.php as recommended above, but there is no new page template showing up when creating a new page. Putting the function on a normal Atahualpa page cuts some of the functionality (compare http://matthiasheil.de/twittertest/ to what things should be like: http://fairyfish.net/twitter/) - the Java parts showing when clicking on "retwitting" and "Add your reply" do not seem to be working...

Help appreciated!-)

Flynn Jul 22, 2009 10:20 PM

There are two types of page template

1. Default Templates based on the WP built in template hierarchy http://codex.wordpress.org/File:Template_Hierarchy.png

You can create these by copying index.php

These have rather generic names such as index.php (must exist in a theme) plus the optional page.php, single.php, archive.php, 404.php, search.php, category.php, home.php, attachment.php etc...

Wordpress will choose the most specific template for a given page type if available, and fall back to a less specfiic one if not, and fall back to index.php at the end.

2. Individual Templates that you can create http://codex.wordpress.org/Pages#Cre...Page_Templates

You can also create these by copying index.php

These need to have
PHP Code:

<?php
/*
Template Name: My individual page template
*/
?>

at the top of the file, and you'll save them as whatever.php (avoiding the reserved default template names like page.php). Wordpress will scan all files in the directory of the active theme and look into the top of the files for that Template Name... part. Then it will list them on the page write panel and you can choose them for a particular page.


The difference between these two is that you can choose the unique templates on a case by case basis for particular pages whereas for the default templates Wordpress will decide which one to use for a given page, based on the file name of the template.

kkk Jul 24, 2009 06:35 AM

I am using second method of creating template.

I have created a template in which I have written some php query. When I am running only my php query then it's giving out put (without header,sidebar and footer)

Then I copied content of index.php to this template and put my query befor get_footer. But copying content from index.php is not working. It is displaying blank page.

redacter Oct 21, 2009 06:36 PM

This sounds like what I am trying to do. I am new to atahaulpa but have some background in html and had no problem creating a basic site, http://www.celebrityhealthfitness.com I'm still fleshing it out but everything is working like a charm. Now, however, I want to build a slightly more ambitious site, with sections. Each "section front" would have the look and functionality of the homepage, with its own blog. I read here that using "author pages" might be an easy way to do this. But is it the best way? Also, I read that changing the index.php to a page.php is another way. Sounds more complicated. Would it be possible to vary the widgets displayed from section front to section front? Also is there any way to get photos to display with posts on category pages? I don't see a control for that.

Thanks in advance for your advice..!

Flynn Oct 30, 2009 07:07 AM

One way to control the appearance of widgets would be the plugin Widget Logic http://wordpress.org/extend/plugins/widget-logic/

To display images on multi post pages use a post thumbnail plugin e.g. http://wordpress.org/extend/plugins/...-for-excerpts/

redacter Nov 5, 2009 07:48 PM

Thanks Flynn... I will check those out. To create the section fronts I wanted I just used subdirectories. Now here's another question, and if you can help me on this, a contribution will definitely be in order.

I want to put a widget box, or container, that spans the right column and the inner right column of the home page, without creating a blank space above the center column and inner and outer left column. Right now I don't see a way to do that. Seems like it should be possible though.

Any help would be greatly appreciated.

Misa Mar 8, 2010 02:40 PM

Hello Atahualpa gurus,

I've come across this post and thought I should ask my question here since it's related...

On my old site which is running Atahualpa 2.21 (and a really old version of Wordpress), I've got 2 page templates that I can use for any given page which calls on either the page.php file or the page2.php file depending on what I select from a drop-down menu within the "Write Page" window.

How would this work on the most recent version of Atahualpa and Wordpress? I've got a new site and need to create pages that are styled differently based on content so thought the best way to do this would be like how it currently is on my old site: use a different page template depending on what I need.

This new-fangled Wordpress and Atahualpa has me baffled though -- amazed but baffled nonetheless! I wasn't able to locate any page.php files within the Atahualpa theme itself (like in the old version) -- just within WP-admin. I'm just curious how to go about doing the multiple page layouts. If I go about it in the same way as my old Atahualpa install and create multiple page.php files (named differently): where would I place these files? Then, how would I go about selecting which template to use when created a page? Would a drop-down box allowing you to select which template you wanted to use appear with the creation of more than one page.php file?

Sorry for the barrage of questions... just want to figure out how to implement this.

Thanks in advance... looking forward to some enlightenment from the gurus!

paulae Mar 8, 2010 03:22 PM

You'll be using the theme's index.php and putting your changes into it, and renaming it. Then you need a plugin which will create a drop-down list of templates to choose from under your editing pane.

There is an explanation of all of this here: http://forum.bytesforall.com/showthread.php?t=6057

Misa Mar 8, 2010 06:50 PM

Thanks so much, Paula. :)

So editing and renaming the index.php within the theme works the same for creating new templates for pages as well as posts? That's where I'm getting confused obviously! So much has changed from my old site, it's crazy. :)

Will check out the plugin you mentioned in the other thread, maybe it can be modified for pages. *crosses fingers*

Cathy131 Apr 10, 2010 02:28 AM

Hi there
Just wondering if someone can help me with this multiple template thing as I think I've been following Flynn's instructions:
• Went to /public_html/wp/wp-content/themes/atahualpa
• Found 'index.php' and copied the file into the same directory, giving it the name nlp-template.php
• Downloaded this file, opened it in text editor, added the code
<?php
/*
Template Name: nlp-template.php
*/
?>
(I didn't delete anything from the original file - just added this code on top)
• Saved the file (nlp-template.php), uploaded it back to the atahualpa directory, overwriting the copy that was there.

Now I'm baffled!

I have created a draft page to add to http://catsbodycrafts.com.au/wp offering a different type of service. The new page needs to have a different logo at the top (and in the future, I’ll no doubt make other changes!).

Where do I go to make those changes (in nlp-template.php)?
How do I find the drop down box to select which template to use for this page?

As you can see, I’m a simple kinda gal so step by step (dot that ‘i’, cross that ‘t’) instructions would be great!

Cheers
Cathy

juggledad Apr 18, 2010 10:16 AM

when you say you need a different logo, are you talking about the header image because that is easy to do. i.e. you can have one image for most of the pages, then have a different image for page 'X', 'Y' and 'Z' and it's all done thru CSS inserts.

If you just want different images, see http://forum.bytesforall.com/showthread.php?t=4389
if you want an entre different header structure, see http://forum.bytesforall.com/showthread.php?t=6681

sleenie Jul 29, 2010 02:20 PM

I want to revive this thread for a quick question. I have a new client that wants a choice between two page templates. One template is a 3 column, no problem, the other is a 2 column, with the main column spanning to the left margins. (basically combing the left sidebar and middle column) Everything else, header, right sidebar etc. would remain the same. I'm not a programmer but reading from the above info, it can be done. Am I correct?

Thanks,
Sleenie

juggledad Jul 29, 2010 07:41 PM

You can exclude the side bars for a page by just adding the page ID to the ato->Style & configure sidebars->Left sidebar: don't display on pages

There is an exclude option for each sidebar - easier than coding a template

sleenie Jul 30, 2010 09:35 AM

Yes, I have used that in the past. However, they want however the space gone, meaning the center content would get moved to the left for just that page (where the left sidebar would normally be) and continues to the right sidebar. Does that make sense?

Sleenie


All times are GMT -6. The time now is 09:41 AM.

Powered by vBulletin® Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.