Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Montezuma Theme (http://forum.bytesforall.com/forumdisplay.php?f=53)
-   -   Using Custom template and sub-template (http://forum.bytesforall.com/showthread.php?t=18659)

rick9004 Oct 13, 2012 08:50 AM

Using Custom template and sub-template
 
I have a copy of the PAGE template that is my main custom page template. I created two sub templates to house my header and footer. In the page I select my virtual template. Then in the custom template I add these statements:

<?php bfa_get_template_part('newheader'); ?>

<?php bfa_get_template_part('newfooter'); ?>

They do not display either header or footer. The main custom template however is working, I know that it is being displayed.

I have tried all sort of variations and checking the spelling of the name. I look at the code for this function and off hand do not see anything wrong.

Either I've got the function call wrong or there is something else that need to be set to get sub-templates to display

jerryc Oct 13, 2012 06:27 PM

Try this concept:

PHP Code:

<?php get_header'whatever' ); ?>

Quote:

Includes header.php sub template.
In case you created a second 'header' sub template in addition to the standard header.php, such as header-2.php, you could include it with <?php get_header( '2' ); ?>. Whatever you put into the brackets will be appended to header with a dash - in between, and that file will be included: E.g. to include header-whatever.php in a main template you would use <?php get_header( 'whatever' ); ?>
PHP Code:

<?php get_footer'whatever' ); ?>

Quote:

Includes footer.php sub template.
Same as get_header but for the 'footer' sub template
You can also use
PHP Code:

<?php dynamic_sidebar'whatever' ); ?

anywhere, including in headers and footers.

jerryc Oct 13, 2012 10:48 PM

Quote:

Originally Posted by jerryc (Post 91352)
Try this concept:

PHP Code:

<?php get_header'whatever' ); ?>

You can also use
PHP Code:

<?php dynamic_sidebar'whatever' ); ?

anywhere, including in headers and footers.

I need to change my headers, too. I just tried the get_header, just like the documentation says, and it didn't work for me. I tried the dynamic_sidebar instead of a header, and it worked in the header, but the styling was terrible.

juggledad Oct 14, 2012 11:53 AM

There is a problem with subtemplates. if you notice they don't get a '.php' extension' This part of the code is being rewritten be the developer for the next release so don't put too much time into it for now.

[Update - 1/30/31] the fact that the extension is not there does't matter, the template will still be used. the issue is just the on screen display

jerryc Oct 14, 2012 08:11 PM

It's great to have your guidance on these things juggledad.

Thanks.

Any eta on the new release?

jerryc Jan 30, 2013 10:53 AM

Juggledad,

A while back, I posted:.

Quote:

Originally Posted by jerryc (Post 91353)
I need to change my headers. I just tried the get_header, just like the documentation says, and it didn't work for me.

You replied:

Quote:

Originally Posted by juggledad (Post 91379)
There is a problem with subtemplates. if you notice they don't get a '.php' extension' This part of the code is being rewritten.

So, I've been making do with one header and one footer for now while working on other stuff in the meantime.

Recently, you posted:

Quote:

Originally Posted by juggledad (Post 95635)
to make a copy of the header (or footer) virtual template do the following
1) go to mto->Sub Templates->+ Add sub template
2) in the 'Template name' field add a name like 'header-custom'. and press the 'ADD Sub Template button.
3) go to mto->Sub Templates->header.php (or footer.php) do a select all and copy
4) go to mto->Sub Templates->header-custom and paste teh code and press 'SAVE Changes'

now where ever you are calling the header (or footer) use the new templage name like
HTML Code:

<?php get_header('header-custom'); ?>

So, I tried it again, this time, using your suggestion of:

HTML Code:

<?php get_header('header-custom'); ?>
instead of how the documentation reads:

HTML Code:

<?php get_header('custom'); ?>
Neither way worked for me. I tried it at the top of my template, and it still gave me the default header. Just for kicks, I copied and pasted the identical code at the bottom of my template, and it gave me nothing at all.

How did you get it to work? What am I missing?

Thanks,

Jerry

P.S. Making a new subtemplate by selecting the option to copy an existing on produced an empty subtemplate for me. Your suggestion of copying and pasting did work to make the file, it just didn't display anything.

juggledad Jan 30, 2013 12:06 PM

export your settings and attach them to a reply

jerryc Jan 30, 2013 12:16 PM

I'm glad that you can read these tea leaves.

P.S. I'm almost out of attachment space. How do I get more, or should I delete things?

juggledad Jan 30, 2013 12:38 PM

Quote:

I'm almost out of attachment space. How do I get more, or should I delete things?
you need to delete things

juggledad Jan 30, 2013 12:43 PM

I don't see a custom-header' in the virtual subtemplates or a reference to it in any of your main virtual templates.

jerryc Jan 30, 2013 01:30 PM

Quote:

Originally Posted by juggledad (Post 95780)
I don't see a custom-header' in the virtual subtemplates or a reference to it in any of your main virtual templates.

Yes, I deleted them after I couldn't get them to work.

juggledad Jan 30, 2013 01:50 PM

Then why did you post on this thread and send your settings?

jerryc Jan 30, 2013 01:59 PM

Quote:

Originally Posted by juggledad (Post 95791)
Then why did you post on this thread

Is there something about the post that you don't understand?

Quote:

and send your settings?
You asked for them. I don't know what they are, or even how to read them. I suspect that the problem isn't about my settings, anyway.

juggledad Jan 30, 2013 06:08 PM

I was incorrect in assuming since you said you tried it again and it didn't work and were asking for help you still had the virtual templates in your site. I asked to see the export because it would contain your templates and I could look to see if there were any errors.

Since you deleted them, you don't have a problem that I can look at and there was no need to spend any time on this. I will close this thread.


All times are GMT -6. The time now is 12:11 AM.

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