Wordpress Themes - WP Forum at BFA
There will be no more development for Atahualpa (or any other theme), and no support. Also no new registrations. I turned off the donation system. I may turn the forum to read only if it gets abused for spam. Unfortunately I have no time for the forum or the themes. Thanks a lot to the people who helped in all these years, especially Larry and of course: Paul. Take care and stay healthy -- Flynn, Atahualpa developer, Sep 2021

Wordpress Themes - WP Forum at BFA » WordPress Themes » Montezuma Theme »

adding physical templates


  #1  
Old Dec 11, 2012, 01:47 PM
jeffe
 
16 posts · Dec 2012
Howdy
I would like to create, with full php power, a template to use for my homepage.
This is so I can use some 'do_shortcode' calls required by other plugins.

What am I missing - there is no spot on my page editor to choose a non-virtual theme.

I have uploaded my theme into the main montezuma theme folder.

I even tried naming it 'front-page.php', but this would not render any headers. I would also just like to know how to use my own templates.

Thank you.
-j
  #2  
Old Dec 11, 2012, 02:24 PM
lmilesw's Avatar
lmilesw
 
10,176 posts · Jul 2009
Central New York State USA
I am not clear on how you installed Montezuma. You should just install like any other theme. Then within the theme options you create the virtual templates.
__________________
~Larry (CNY Web Designs)
This site should be a membership site since it so full of good stuff.
Please consider donating which gives you access to even more good stuff.
  #3  
Old Dec 11, 2012, 03:35 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
If you want to create page templates outside the theme options, copy index.php as your base. It will not be editable via the theme options, but you can use dashboard->appearances->editor to edit it.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #4  
Old Dec 12, 2012, 01:03 PM
jeffe
 
16 posts · Dec 2012
Thanks for the replies...
Quote:
Then within the theme options you create the virtual templates.
I don't want to use virtual templates - I want to create physical templates so I can use all the usual php functions and specifically some 'shortcode' from other plugins.

Quote:
If you want to create page templates outside the theme options, copy index.php as your base. It will not be editable via the theme options, but you can use dashboard->appearances->editor to edit it.
I tried that - but there is no place in the page editor to choose a non-virtual template.

Here is a clear example...
I want to create a full php template (not a virtual template) called 'mytemplate.php'. I want to apply this to a page I create called 'My Page'.
I can definitely start by copying index.php - but then how do I use that template for 'My page'?

Part of Montezuma's ad says 'The ability to create physical page templates is preserved.'... how do I still use these 'physical' page templates if there is no way to assign them via the page editor? I only see option to use virtual templates.

Last edited by jeffe; Dec 12, 2012 at 01:05 PM.
  #5  
Old Dec 12, 2012, 01:08 PM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Quote:
how do I still use these 'physical' page templates
the same as you would fro any theme. When you create a page look in the right hand colum for the section 'Templates' that is where you pick your template.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #6  
Old Dec 12, 2012, 01:13 PM
jeffe
 
16 posts · Dec 2012
Thats what I thought - but I only have boxes labelled:
Publish - Page Attributes - Virtual Templates - Featured Image


I have also checked 'Screen Options' but found nothing that seems to help.
Thanks yall

edit: also using latest version of wordpress (3.5) but experienced the same behavior on 3.4.2

Last edited by jeffe; Dec 12, 2012 at 01:22 PM.
  #7  
Old Dec 12, 2012, 01:30 PM
lmilesw's Avatar
lmilesw
 
10,176 posts · Jul 2009
Central New York State USA
You, of course, do have to add code to the top of your template to let WordPress know it is a template. For example
PHP Code:
<?php
/*
Template Name: My Template
*/
?>
__________________
~Larry (CNY Web Designs)
This site should be a membership site since it so full of good stuff.
Please consider donating which gives you access to even more good stuff.
  #8  
Old Dec 12, 2012, 01:37 PM
jeffe
 
16 posts · Dec 2012
Thank you, that did the trick.

I thought there was something like that but could not find an example in the montezuma theme.

Thank you again...
-j
  #9  
Old Dec 12, 2012, 01:44 PM
jeffe
 
16 posts · Dec 2012
Of course this opens up a new myriad of issues as get_header.php doesn't really do what I want.
I'm assuming this is because the default Montezuma header has Montezuma-specifc code in it.

A suggestion would be to include an example for a physical template so we could work off of that.

THank yall
  #10  
Old Dec 12, 2012, 01:47 PM
lmilesw's Avatar
lmilesw
 
10,176 posts · Jul 2009
Central New York State USA
That info is in the WordPress Codex.
__________________
~Larry (CNY Web Designs)
This site should be a membership site since it so full of good stuff.
Please consider donating which gives you access to even more good stuff.
  #11  
Old Dec 12, 2012, 02:21 PM
jeffe
 
16 posts · Dec 2012
edit: the info in this post only gets you halfway...
Thanks
For anyone else, the issue was partly because 'get_header()' referenced the montezuma 'header.php' which only had code to reference the montezuma virtual subtemplate 'header'.

I created a new file, 'header-template.php' and referenced that in my physical template with get_header('template').
Then, I copy/pasted all the data from head.php, and added on the contents of the virtual 'header.php' sub-template.
Then, I copy/pasted all the lines AFTER the get_header call in the contents of the 'index.php' VIRTUAL template, into my new physical template.

Adding a basic loop in there, and we are good to go.

Thanks for your help again.
-j

Last edited by jeffe; Dec 12, 2012 at 03:30 PM.
  #12  
Old Dec 12, 2012, 03:29 PM
jeffe
 
16 posts · Dec 2012
Bump - this is not working out as easily as it looked.

There is still 'some' missing data from my template which I'm not sure how to get at.

For example, some of my plugins became disabled, and the wordpress menu (when you are logged in) that normally overlays the page at the top is gone as well.

Any ideas how to get a generic 'physical' template working?

thank yall
-j
  #13  
Old Dec 12, 2012, 03:58 PM
jeffe
 
16 posts · Dec 2012
OK - think I got it.

Here are the files I used to create a new generic physical template that works with montezuma:
header-template.php:
Code:
<?php get_template_part( 'head' ); ?>
</head>
<body <?php body_class(); ?>>
	<div id="banner-bg" class="cf">
	<div id="banner" class="row">
		<div id="logo-area" class="col5">
			<<?php bfa_if_front_else( 'h1', 'h3' ); ?> id="sitetitle">
				<a href="<?php echo home_url(); ?>"><?php bloginfo( 'name' ); ?></a>
			</<?php bfa_if_front_else( 'h1', 'h3' ); ?>>
			<p id="tagline"><?php bloginfo( 'description' ); ?></p>
		</div>
        <?php wp_nav_menu( array( 
			'container' => 'nav', 
			'container_class' => 'menu-wrapper col7', 
			'container_id' => 'menu1-wrapper', 
			'menu_id' => 'menu1', 
			'menu_class' => 'cf menu', 
			'theme_location' => 'menu1', 
			'fallback_cb' => 'bfa_page_menu' 
		) ); ?>
		</div><!-- banner -->
	</div><!-- banner-bg -->
	<a href="<?php bloginfo( 'rss2_url' ); ?>" class="rsslink" title="<?php _e( 'Subscribe to RSS Feed', 'montezuma' ); ?>"></a>
new-template.php:
Code:
<?php 
/*
Template Name: New Template
*/
get_header('template');
?> 
	<div id="main" class="row">
		<div id="content" class="cf col8">
	 	<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
			<?php the_content();?>
		 <?php endwhile; else: ?>
		 <p>Sorry, no posts matched your criteria.</p>
		 <?php endif; ?>
		</div>		
		<div id="widgetarea-one" class="col4">
			<?php dynamic_sidebar( 'Widget Area ONE' ); ?>
		</div>	
	</div><!-- main -->
	<?php wp_footer(); ?>
	<?php get_footer('template'); ?>
footer-template.php:
Code:
</body>

</html>
  #14  
Old Jan 8, 2013, 09:28 AM
Michael4fm's Avatar
Michael4fm
 
38 posts · Nov 2011
Manchester, UK
Thanks for posting this, Jeffe

I've been struggling with 'custom' physical templates too, and using your code I think I'm now moving in the right direction.

For anyone else who comes looking: I got a slight 'lining up' problem with the physical header not quite matching my 'virtual' ones. Seem to have solved this by copying and repasting the text from the virtual template file 'header.php'. [Jeffe's example doesn't include the 'breadcrumbs' div] I also couldn't get it to display comment and footer templates ... but seem to have resolved this by using get_footer() instead of get_footer('template') in new-template.php

Have to agree with Jeffe ... life would have been far simpler if there was a 'sample' physical template to re-engineer from! But it's such a great looking - and generally working - theme that I really hope I crack any problems instead of giving up!

If you want to see how it's going - in case I've worked out how to do something you're trying to - check out http://www.other.s-t-u-f-f.net and http://www.play.s-t-u-f-f.net ... the former is a 'real' site (which I'm developing first using Wampserver offline) and the latter is a 'test' site to check things work on my real server as they did on the Wampserver!

Last edited by Michael4fm; Jan 8, 2013 at 02:34 PM. Reason: Added links to 'example' sites
  #15  
Old Jan 8, 2013, 02:36 PM
jerryc
 
367 posts · Oct 2012
Florida
Quote:
Originally Posted by Michael4fm
Have to agree with Jeffe ... life would have been far simpler if there was a 'sample' physical template to re-engineer from!
It's quite simple to reengineer from the virtual templates. From the dashboard > appearance > montezuma options > main templates, when you create a new template, there's an option to copy an existing one. Try starting there, and things might be easier, particularly with having things line up.
  #16  
Old Jan 8, 2013, 02:46 PM
Michael4fm's Avatar
Michael4fm
 
38 posts · Nov 2011
Manchester, UK
Tried that ... most copied templates seem to be coming up 'blank' for some reason ... and I'm fairly sure that when I have copied the contents of a 'virtual' template to ".../wp-content/themes/montezuma" although the re-engineered page / post etc. is there, there's no styling / header / footer etc. Jeffe's way may not be the 'right' way ... but it's working
  #17  
Old Jan 8, 2013, 03:55 PM
jerryc
 
367 posts · Oct 2012
Florida
Quote:
Originally Posted by Michael4fm
Tried that ... most copied templates seem to be coming up 'blank' for some reason
I never had that problem, but I'm only using wp for pages right now, not posts.

When you say blank, do you mean the template file in the online editor is blank or the page /post where you use the template is coming up blank?
  #18  
Old Jan 8, 2013, 04:24 PM
Michael4fm's Avatar
Michael4fm
 
38 posts · Nov 2011
Manchester, UK
Quote:
Originally Posted by jerryc
When you say blank, do you mean the template file in the online editor is blank or the page /post where you use the template is coming up blank?
The template file is blank ... think when I accidentally reload some of the templates I'm trying to copy (I'm left handed, and the 'save' and the 'reload original template' buttons are dangerously close together!) they're blank too ... but I've been playing around so much trying to get a physical template that may be my own fault.

I need to use 'non-standard' php and 'if' conditions in posts ... and once I've cracked that (which I seem to have!) then I need to use what I learn on 'index.php' and all of the other WP templates that are similar ... 'category.php', 'tag.php', 'search.php', etc. (Hey, maybe I'll even work out how to get two columns of excerpts. That was my original start point anyway ... led me to this theme, now it's taking days and days! )

Last edited by Michael4fm; Jan 8, 2013 at 04:27 PM.
  #19  
Old Jan 8, 2013, 05:00 PM
jerryc
 
367 posts · Oct 2012
Florida
Quote:
Originally Posted by Michael4fm
The template file is blank ... think when I accidentally reload some of the templates I'm trying to copy (I'm left handed, and the 'save' and the 'reload original template' buttons are dangerously close together!) they're blank too ... but I've been playing around so much trying to get a physical template that may be my own fault.
Create them via the dashboard editor, not ftp. Stuff you ftp doesn't usually show up right, at least that's my experience, and what I remember juggledad saying. Ever since I did that, I haven't had a problem.

Also, any template can be restored to it's defaults. On the edit page, there's a reset button. Maybe you can try that with an obscure one, and see what happens.

Quote:
I need to use 'non-standard' php and 'if' conditions in posts ... and once I've cracked that (which I seem to have!) then I need to use what I learn on 'index.php' and all of the other WP templates that are similar ... 'category.php', 'tag.php', 'search.php', etc. (Hey, maybe I'll even work out how to get two columns of excerpts. That was my original start point anyway ... led me to this theme, now it's taking days and days! )
Ok, I'll preface this part for the newbies who don't know any php to ignore this, as it may be over their head.

Even though I don't know much about posts or excerpts, I do understand php arrays. I have an example of one posted here that might be helpful as a starting point. Here's the sequence of what I'm doing:
  1. make an array of my images
  2. order them the way I want (in my case, random)
  3. put the first 6 in row 1
  4. put the next 6 in row 2

Modified to what it sounds like you're doing:
  1. make an array of your excerpts
  2. order them the way you want (probably descending date order)
  3. put the first n in column 1
  4. put the next n in column 2

If, instead, you wanted them laid out:
1 | 2
3 | 4
5 | 6
...

or a different group of excerpts in each column, you'd just modify the code accordingly, which it sounds like you can figure out.

I hope this helps.
  #20  
Old Jan 8, 2013, 05:45 PM
Michael4fm's Avatar
Michael4fm
 
38 posts · Nov 2011
Manchester, UK
Quote:
Originally Posted by jerryc
Create them via the dashboard editor, not ftp. Stuff you ftp doesn't usually show up right, at least that's my experience, and what I remember juggledad saying. Ever since I did that, I haven't had a problem.
Never had a problem with FTP, and I've just set up a 'wampserver', so it's easier for me to play directly then FTP once a file works as I want it.

Quote:
Originally Posted by jerryc
Also, any template can be restored to it's defaults. On the edit page, there's a reset button. Maybe you can try that with an obscure one, and see what happens.
If the defaults that are coming up blank. The 'reset' button you mention is the same one as I called 'dangerous'. [If anyone who has the ear of the developer is reading this, a simple "Confirm you really want to do that" button would be very very useful for reckless people like me]

...

Thanks for the link and the suggestions. It sounds a bit complicated for me ... the excerpts will be generated by the visitor, using the "Query Multiple Taxonomy" plugin and working out how to turn that into an array ... (which I'm not yet at all familiar with anyway tbh); but I only need one image for each excerpt on the site I'm currently working on, so there could be a lot of 'white' space.

Now I've sussed out physical templates I think I'll be able to 'hack' the POSTS loop to get a 1-3-5 column and a 2-4-6 one. I'm leaving that till 'last' though ... I suspect I'll be saying goodbye to a large chunk of my life to get that working!

Last edited by juggledad; Jan 9, 2013 at 04:25 AM.
  #21  
Old Jan 8, 2013, 09:14 PM
jerryc
 
367 posts · Oct 2012
Florida
Quote:
Originally Posted by Michael4fm
Never had a problem with FTP, and I've just set up a 'wampserver', so it's easier for me to play directly then FTP once a file works as I want it.
The problem isn't with FTP. As I understand it, making a template any other way other than the dashboard editor is, to my understanding, not recommended.

Quote:
If the defaults that are coming up blank. The 'reset' button you mention is the same one as I called 'dangerous'. [If anyone who has the ear of the developer is reading this, a simple "Confirm you really want to do that" button would be very very useful for reckless people like me]
If you're using the editor and the resets are coming up blank, that may be because you overwrote the original files via some other method. You may want to get original files somewhere. Jug probably knows much more about this.

Last edited by juggledad; Jan 9, 2013 at 04:26 AM.
  #22  
Old Jan 9, 2013, 02:52 AM
Michael4fm's Avatar
Michael4fm
 
38 posts · Nov 2011
Manchester, UK
Quote:
Originally Posted by jerryc
If you're using the editor and the resets are coming up blank, that may be because you overwrote the original files via some other method. You may want to get original files somewhere.
You're probably right ... hence my comment that it may have been my own fault! I've got the original files saved somewhere, so if I need to access them I'm sure I'll be able to relatively easily.
  #23  
Old Jan 9, 2013, 04:29 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
Quote:
If the defaults that are coming up blank. The 'reset' button you mention is the same one as I called 'dangerous'. [If anyone who has the ear of the developer is reading this, a simple "Confirm you really want to do that" button would be very very useful for reckless people like me]
good idea.

see RFE 013-07: Add a confirm dialogue to all the 'reset' options
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #24  
Old Jan 9, 2013, 04:36 AM
juggledad's Avatar
juggledad
 
23,765 posts · Mar 2009
OSX 10.11.5 WP 4.x Atahualpa(all) Safari, Firefox, Chrome
FTP - issues that arise when using FTP depends on how your host is set up and the server UID of teh 'wordpress' user verses the UID of the 'FTP' user. On some hosts, they work together, on some hosts they don't. And that's as far as I'm going to go into it. to give a detailed explaination that a layperson could understand would take a couple hours to think up and write up and edit and since no one is paying me to do it...for a detailed explaination go do a bunch of research on user premissions in apache, wordpress, and ftp.
__________________
"Tell me and I forget, teach me and I may remember, involve me and I learn." - Benjamin Franklin
Juggledad | Forum Moderator/Support
  #25  
Old Jan 9, 2013, 04:56 AM
Michael4fm's Avatar
Michael4fm
 
38 posts · Nov 2011
Manchester, UK
Thanks for the 'short version' explanation, Juggledad. I guess I'm lucky in that FTP has always worked for me with pretty much no problems. I'll continue to use this method, but if it goes belly-up one day, I'll remember your wise words and switch to direct editing via the WP dashboard instead!

Bookmarks

Tags
custom, php, shortcode, templates

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
Templates for navigation bar JakeThePeg Page & Category Menu Bars 2 Jan 20, 2010 10:33 PM
Templates viscouse Atahualpa 3 Wordpress theme 2 Jun 12, 2009 10:59 AM
Using my own templates nickcee Atahualpa 3 Wordpress theme 1 May 16, 2009 06:56 PM
Different Page templates paulae Atahualpa 3 Wordpress theme 2 Mar 10, 2009 04:08 PM


All times are GMT -6. The time now is 02:43 AM.


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