Wordpress Themes - WP Forum at BFA
Click Here To DONATE! Support the theme development, get more attention and additional benefits based on your donation level. Your forum name will be highlighted.

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

Correct way to create sidebars?


Build custom WP THEMES, without
coding.
Click here for THEMEFRAME

From the author of Atahualpa, the #1 most
downloaded (700,000+) theme @ wordpress.org
  #1  
Old Feb 2, 2013, 08:02 AM
Michael4fm's Avatar
Michael4fm
 
38 posts · Nov 2011
Manchester, UK
The 'automatic' sidebar creation in Montezuma is great, but is there a 'right' way to do it consistantly? I'm using a lot of physical templates and they don't seem to automatically create the sidebars they need.

I'm currently getting around the challenge by 'creating' them in one of the virtual comments subtemplates, which I'm not actually using. Works fine, but if there's a 'proper' way, I should probably be doing that!

[If there isn't, could I suggest that my 'hack' would seem to be easy to incorporate as a 'proper' feature at a later date?]
  #2  
Old Feb 2, 2013, 09:13 AM
lmilesw's Avatar
lmilesw
 
10,107 posts · Jul 2009
Central New York State USA
What do you mean by "automatic sidebar creation"?
__________________
~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 Feb 2, 2013, 09:30 AM
Michael4fm's Avatar
Michael4fm
 
38 posts · Nov 2011
Manchester, UK
When you use <?php dynamic_sidebar( '...name...' ); ?> in a virtual template, it automatically creates a widget area called "...name..." that you can view through Appearance | Widgets and add widgets to.
  #4  
Old Feb 2, 2013, 10:07 AM
jerryc
 
367 posts · Oct 2012
Florida
Quote:
Originally Posted by Michael4fm
When you use <?php dynamic_sidebar( '...name...' ); ?> in a virtual template, it automatically creates a widget area called "...name..." that you can view through Appearance | Widgets and add widgets to.
That sounds like the right way to me. I don't use and wouldn't recommend physical templates, but ymmv.

Last edited by jerryc; Feb 2, 2013 at 10:12 AM.
  #5  
Old Feb 2, 2013, 10:18 AM
Michael4fm's Avatar
Michael4fm
 
38 posts · Nov 2011
Manchester, UK
Yeah, but if you use <?php dynamic_sidebar( '...name...' ); ?> in a physical template, they don't get created - so at the moment I'm creating them by adding a 'phantom' entry in one of the comments.php sub-template which I don't use. I'm sure that wouldn't be the 'right' way to do it, so was wondering if there is a 'proper' way I should ... or given that it seems so easy to do, suggesting as a feature that another entry in one of the sub-templates (possibly "comments" as it already works there and the template is already "bits of") be added to allow for sidebar creation.
  #6  
Old Feb 2, 2013, 10:29 AM
lmilesw's Avatar
lmilesw
 
10,107 posts · Jul 2009
Central New York State USA
I am really confused as to what you are trying to do. For instance you talk about creating a phantom entry in a comment.php sub template. Why are you not just adding the code for the new widget area to index.php for instance?
__________________
~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.
  #7  
Old Feb 2, 2013, 10:40 AM
jerryc
 
367 posts · Oct 2012
Florida
Quote:
Originally Posted by Michael4fm
... suggesting as a feature that another entry in one of the sub-templates ... be added to allow for sidebar creation.
It might be a nice feature. Until it's added, I think you have found the only workable way, without more extreme code hacking.

With the approach your'e taking, you could have an unused virtual template with unlimited sidebars, any of which could then be used in any other template(s).

Bear in mind, if you're using physical templates, if you use existing names, such as index.php, your edits will get clobbered with a theme upgrade. This doesn't happen with virtual templates.
  #8  
Old Feb 2, 2013, 10:52 AM
Michael4fm's Avatar
Michael4fm
 
38 posts · Nov 2011
Manchester, UK
Sorry to confuse.

Creating a sidebar only works (or seems to) when you are using virtual templates. If you are using physical templates the sidebar doesn't get created. I'm therefore creating the sidebar in one of the virtual comments.php areas which I never use ... then it's there when I use the dynamic sidebar code in my physical templates.

It works .. I just wondered if there was a better / 'proper' way to do it, and was suggesting that as it works and it seems fairly easy, it might be worth considering it as a feature to add to future releases.
  #9  
Old Feb 2, 2013, 11:30 AM
lmilesw's Avatar
lmilesw
 
10,107 posts · Jul 2009
Central New York State USA
Then the question is why are you creating physical templates? As JerryC mentioned those will get overwritten with a theme upgrade.
__________________
~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.
  #10  
Old Feb 2, 2013, 11:46 AM
Michael4fm's Avatar
Michael4fm
 
38 posts · Nov 2011
Manchester, UK
I need to use php and shortcodes which don't work in virtual templates.

Will they get overwritten? I thought physical templates, stored in ".../wp-content/themes/montezuma" were safe? Not a biggie if that's not the case, as I have copies locally I can just FTP again.
  #11  
Old Feb 2, 2013, 02:53 PM
lmilesw's Avatar
lmilesw
 
10,107 posts · Jul 2009
Central New York State USA
I believe they will get overwritten. Even if they don't I always work within theme constraints. If I wanted to include PHP I would add a widget area and use a widget that allows PHP.
__________________
~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.
  #12  
Old Feb 2, 2013, 03:01 PM
jerryc
 
367 posts · Oct 2012
Florida
Quote:
Originally Posted by lmilesw
I believe they will get overwritten. Even if they don't I always work within theme constraints. If I wanted to include PHP I would add a widget area and use a widget that allows PHP.
I agree with Larry. Have you tried this technique? It works with virtual templates.

One thing I like about snippets better than shortcodes is that every function is available to every other function. So are variables that you declare as globals (if, hopefully, your server allows them).

Bookmarks

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes


Similar Threads
Thread Thread Starter Forum Replies Last Post
How to create space between TD#Middle and Sidebars? Masselyn Atahualpa 3 Wordpress theme 3 Dec 1, 2009 03:36 AM


All times are GMT -6. The time now is 05:54 PM.


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