Wordpress Themes - WP Forum at BFA

Wordpress Themes - WP Forum at BFA (http://forum.bytesforall.com/index.php)
-   Sidebars & Widgets (http://forum.bytesforall.com/forumdisplay.php?f=14)
-   -   Template-Specific Widgets (end user in mind) (http://forum.bytesforall.com/showthread.php?t=4884)

Dockery Dec 14, 2009 09:07 PM

Template-Specific Widgets (end user in mind)
 
================================================== =================
= see http://forum.bytesforall.com/showthread.php?t=13352
= and 'HOWTO: create a 'no sidebar' template (or 1, 2, 3 or 4 sidebar template)' in the Gold Forum Tutorials
================================================== =================


Using the method set down by Flynn to create different page templates ( see: http://forum.bytesforall.com/showthread.php?t=711 ) I was able to make 2 new templates. How can I remove the sidebar from one template completely for a wider page?

They will probably use the wide template many, many times, and ALSO keep the widgeted page many times. I looked into widget logic, but as the end user starts adding page after page to his blog, he will probably *Forget* how to add these changes to the widgets and get angry with me.

Is there a solution where I can simply remove the entire sidebar set from one of these template pages? for example can I make a copy of the footer (footer2.php) which removes the code for the sidebar and then access that file ONLY through one of these template pages?

Many Thanks in advance!

juggledad Dec 15, 2009 04:42 AM

each page you create has a page ID. In the sidebar styling options, there is an option to exclude the sidebar by page id. It also explains how to find the ID.

Dockery Dec 15, 2009 08:07 AM

Every time they created a page, would they then have to find the page ID, and make the adjustment, or Is this an adjustment I can make for the template page and not have to worry about them getting confused for?

Where can I make that adjustment? Thanks!

juggledad Dec 15, 2009 09:59 AM

yes you would have to do it for each page.

This is a wordpress issue. A template is nothing, just that, it is a TEMPLATE. It doesn't really become part of wordpress untill someone creates a PAGE. This PAGE has an ID that can be styled.

Atahualpa is a theme that works on the posts and pages that exist within wordpress. The template doesn't exist within the WordPress database, so the theme doesn't know about it.

You can create a page with a template and then remove the template, but the page still exists and this is what Atahualpa works with.

If you want to dig thru the code, you may find a way of doing it.

Adam Dec 16, 2009 12:57 PM

I have limited success with the template-specific sidebars, but I've only gotten it to work for DISPLAYING sidebars that normally are turned off.

Step One:
Because the sidebars are not created in the Main Index Template, but rather in the Header and Footer files, I had to first combine them all into on new page template file. Lets call it SpecialPage.php

Step Two:
Go into SpecialPage.php and find the code block for the sidebar you want to turn on.
Change the line that looks like:

PHP Code:

<?php if ( $bfa_ata['right_col'] == "on" ) { ?>

to:

PHP Code:

<?php if ( == ) { ?>

This turns on that sidebar when that template is in use.

Step Three:

The header needs to know how many columns are underneath it to display correctly. Usually it calls a function to check what sidebars are being displayed and figures it out from there. Step two just screwed up it's ability to do that. So, since you know how many columns there are underneath, just tell it.

Find:

PHP Code:

<td id="header" colspan="<?php echo $bfa_ata['cols']; ?>">

and change it to:

PHP Code:

<td id="header" colspan="X"

with X being the total number of columns turned on for pages using this template.


So...
That works.


But now I have a problem-
I can't do the opposite-
turn OFF specific sidebars.

I tried doing exactly what I described herein, but telling them to turn off by changing the IF statement to IF 1=2. This almost works, but not quite. It screws up layout:

When i use this hack to REPLACE one sidebar with another (usually "Right" displays, but for SpecialPage I want "Right-inner") the right inner sidebar displays, with right inner sidebar content... But with the Width of the right sidebar.

I CANNOT figure out what is causing this. It seems really weird to me.
I even tried changing the ID of the that SpecialPage sidebar, and then styling it specifically in CSS. No such luck. My browser knows that width is supposed to be X (according to Chrome's "Inspect Element" tool), but it displays as Y.


Also- if I normally only have one sidebar on, but want to turn on an additional sidebar for SpecialPage, it pushes the sidebar content out of the layout container like it doesn't have room for it.

In both of these instances, it's acting as if the center content column has a fixed width that won't expand or contract, and my right sidebars just have to deal with it.

Note- the "it works" stuff was all with the left sidebars, and the "WTF" stuff was all with the right sidebars.

Adam Dec 17, 2009 12:11 PM

Some updates...

I figured out my problem, and realized part of the answer was something that I did originally, but since have forgotten to do.

Near the top of the body, the theme generates several columns. These are turned on or off based on whether the ATO settings. But if you're trying to creating Template specific sidebars, you can't forget to toggle them on or off yourself.

The code looks like:

PHP Code:

<colgroup>
<?php if ( $bfa_ata['left_col'] == "on" ) { ?><col class="colone" /><?php ?>
<?php 
if ( $bfa_ata['left_col2'] == "on" ) { ?><col class="colone-inner" /><?php ?>
<col class="coltwo" />
<?php if ( $bfa_ata['right_col2'] == "on" ) { ?><col class="colthree-inner" /><?php ?>
<?php 
if ( $bfa_ata['right_col'] == "on" ) { ?><col class="colthree" /><?php ?>
</colgroup>

You need to match which ones you're turning on/off with which sidebars you want to turn on/off in the body.

Doing that allowed me to have one sidebar that I show on normal pages (in my case, "Right") and then on Special pages, I show the other three.- But I don't have to go into ATO every time I create a new page of that type. As long as I (or the client) selects the right template, everything works.

And if you needed to create additional sidebars that showed up on different templates, that wouldn't be too difficult either, as long as you remember the general format.


Oh, also-
There's a colspan in the footer you have to adjust as well, otherwise your footer gets confused.

PHP Code:

<!-- Footer -->
<td id="footer" colspan="<?php echo $bfa_ata['cols']; ?>">

needs to be

PHP Code:

<!-- Footer -->
<
td id="footer" colspan="X"

again, X= the total number of sidebars you want displayed on that template.


Hope that helps some other people.

Dockery Dec 17, 2009 07:39 PM

Wow, that is some deep delving!

I'll be giving that a try. THanks!


All times are GMT -6. The time now is 03:52 PM.

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