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)
-   -   [SOLVED] Custom sub templates not working (http://forum.bytesforall.com/showthread.php?t=19940)

asifnkhan Mar 20, 2013 05:33 AM

[SOLVED] Custom sub templates not working
 
I have created a sub-template to show three widgets below the main row and above footer. The problem is that when I call those templates from any main template they just don't work. To me, the code is right as if I insert same code directly into footer.php, it works. But, I can't use it because I just want to show those widgets on single posts/pages not the homepage. Check the code below:

Code:

<div id="footerwidget-bg">
<div id="main" class="row">
 
<div id="footerwidget-one" class="col4">
        <?php dynamic_sidebar( 'Footer Widget ONE' ); ?>
</div>

<div id="footerwidget-two" class="col4">               
              <?php dynamic_sidebar( 'Footer Widget TWO' ); ?>
</div>
         
<div id="footerwidget-three" class="col4">
        <?php dynamic_sidebar( 'Footer Widget THREE' ); ?>
</div>       

</div>
</div>

I am using below code to call the widgetsinfooter.php sub template.

Code:

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

jerryc Mar 20, 2013 05:54 AM

For the templates where you want to use it, such as single.php and page.php, if you insert all that code above:

HTML Code:

<?php get_footer(); ?>
it should do what you want.

Another possibility would be to make a separate footer and put that code into the top of a special footer, but I and others have had some difficulty making other footers work. I think there's a patch for that, but I haven't used it.

asifnkhan Mar 20, 2013 06:15 AM

Yeah, inserting the whole code directly works but that makes the template a bit more complex. I wanted to use the sub templates to make it compact and quick in editing.

And to make a special footer I'll have to create another sub-template which also won't work, custom sub-templates are just not working for me.

Can you please link to the patch you are talking about?

Thanks for the response.

jerryc Mar 20, 2013 06:26 AM

Quote:

Originally Posted by asifnkhan (Post 98389)
Yeah, inserting the whole code directly works but that makes the template a bit more complex. I wanted to use the sub templates to make it compact and quick in editing.

And to make a special footer I'll have to create another sub-template which also won't work, custom sub-templates are just not working for me.

Bear in mind, this is only the first release of MZ, and it's by a developer who's already well known for creating another great theme. If you can make it work now with some workarounds, I expect a lot of the problems will be gone with the next release.

Quote:

Can you please link to the patch you are talking about?
I think it's this one. All the patches are in stickies at the top of the MZ forum.

This one might make your approach work, too. I haven't tried any of them. I've been able do to all I need with workarounds.

asifnkhan Mar 20, 2013 06:44 AM

OK, I'll have to put the code directly in templates to make it work. And, for the developer, he has already put some amazing work in this theme, I am not asking for more but improvements are always welcome.

Thanks for you replies. I'll see if I can make it work with sub templates.

juggledad Mar 20, 2013 08:24 AM

please try the following
1) unzip the attached file
2) move the two files to the 'montezuma/includes' folder
3) change your
HTML Code:

<?php bfa_get_template_part( 'widgetsinfooter' ); ?>
to
HTML Code:

<?php bfa_get_template_part( 'widgetsinfooter', '' ); ?>
and see it that works for you.

asifnkhan Mar 20, 2013 08:37 AM

Thank you Sir for your response. Unfortunately, I can't find any attached file, may be it's just me.

Also, is there any way to add a condition to the widget areas? For instance, If there is nothing in the widget area then it just won't render on the site and if it has something then it will show on the site. Right now, empty or not, it just reserves the space on the site for the widget.

juggledad Mar 20, 2013 08:39 AM

1 Attachment(s)
oops, I definately need another cup of coffee :p
here it is
make sure you add the other patches also

asifnkhan Mar 20, 2013 08:53 AM

Woohoo, that worked. Thanks a lot Sir for this.

Only one more thing (for now), is there any way to add a condition to the widget areas? For instance, If there is nothing in the widget area then it just won't render on the site and if it has something then it will show on the site. Right now, empty or not, it just reserves the space on the site for the widget.

juggledad Mar 20, 2013 09:29 AM

You don't need to do anything EXCEPT change the ID you are using

ID's must be unique on a page, you now have two ID's called 'main' and there is some CSS applied to that ID.

Change your ID to 'mymain' and watch what happens.

asifnkhan Mar 20, 2013 09:43 AM

Thanks for the help, will try it later. As my primary issue is solved, marking this thread as solved.

Thanks again and regards.


All times are GMT -6. The time now is 07:19 PM.

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