Show Sidebar only on Posts [SOLVED]

General questions pertaining to how certain issues can be resolved
Forum rules
1. No offensive language and no mocking
2. Please do a thorough search before you post something. Trust us, there is a high probability that the question you are asking has been asked previously.
3. No soliciting. You cannot post here soliciting bids for people offer you quotes, or even offer money to people for some work. You will be moderated if you do so. If you are looking for help, please post your request on http://jobs.wordpress.net or http://codepoet.com
4. Please be reasonable. You are getting software and support. For free. Complicated requests from a general purpose theme are not welcome and some volunteers might lose patience with you.
5. Please do your due diligence. If you posted a query and we answered with a link, take the trouble to go through the link contents.
6. Please post with complete information. Requests for help MUST be accompanied with your URL, particularly if you are asking something like "Why am I seeing a blank space?"

Re: Show Sidebar only on Posts

Postby raubvogel » 12 Jun 2012, 08:44

Back again with a new Idea:

In "functions/actions.php" there is a function
Code: Select all
function suffusion_get_pseudo_template_class() { ... }

which applies a filter called "suffusion_pseudo_template_class". I tried to mimic the last part of the code, i.e. to fake a "suf_pseudo_template = 1r" custom field.

I added the following code to my "functions.php"
Code: Select all
add_filter('suffusion_pseudo_template_class', 'custom_template_extra_post_classes');

function custom_template_extra_post_classes($template)
{
    if (is_single())
    {
       global $suffusion;
       if (!isset($suffusion) || is_null($suffusion)) {
          $suffusion = new Suffusion();
       }
       
        $template[] = 'page-template-1r-sidebar-php';
        $suffusion->set_body_layout($template);
    }
   
    return $template;
}

The area for the sidebar is shown but the sidebar itself is not shown. Does somebody know what is wrong?
raubvogel
 
Posts: 11
Joined: 10 May 2012, 03:33
Location: Berlin, Germany

Re: Show Sidebar only on Posts

Postby raubvogel » 12 Jun 2012, 15:02

I finally got it :D
Code: Select all
/**
 * Force suffusion to show right sidebar on single posts.
 */
// filter for the sidebar count
add_filter('suffusion_right_sidebar_count', 'custom_suffusion_right_sidebar_count');

function custom_suffusion_right_sidebar_count($ret, $side, $context)
{
   // return 1 if single post
   if (is_single())
      $ret = 1;
   
   return $ret;
}

// filter for the pseudo template class
add_filter('suffusion_pseudo_template_class', 'custom_template_extra_post_classes');

function custom_template_extra_post_classes($template)
{
   // return 1 right sidebare template if single post
   if (is_single())
      $template[] = 'page-template-1r-sidebar-php';

   return $template;
}
raubvogel
 
Posts: 11
Joined: 10 May 2012, 03:33
Location: Berlin, Germany

Re: Show Sidebar only on Posts [SOLVED]

Postby minty » 21 Jun 2012, 16:35

I've hit exactly this issue, and I would rather see it added as a feature than have to hack code or go and adjust a bunch of settings.

Situation:
* I set up a site with a lot of pages with no right sidebar. Posts are the same.
* client changes their mind and want a right sidebar, but *only* for posts, to show 'recent posts'.
* I look at all the options for setting layouts: category view, blog page etc... great, one easy place to change them to 1l1r sidebar.
* Except... there's no choice for single posts. Strange omission.

My options: hack code as above (and deal with it on every suffusion update) or change my default to 1l1r and then edit every damn page setting to override that!

I reckon that adding a layout options for Single Posts, in exactly the same way as there are for all the other post-related layouts, would be ace.

Just my 2c!
minty
 
Posts: 34
Joined: 21 Sep 2010, 21:55

Re: Show Sidebar only on Posts [SOLVED]

Postby sayontan » 21 Jun 2012, 17:32

minty wrote:My options: hack code as above (and deal with it on every suffusion update) or change my default to 1l1r and then edit every damn page setting to override that!

Strictly speaking, the above changes are in a child theme - you don't have to change your code every time you update.

Basically choices are like a can of worms. Who would guess, that a year back you couldn't differentiate between the number of sidebars on categories vs. default views vs. some other view? Who would guess that till the start of this year you couldn't assign a template and a layout to a page? But as more options are provided, there is a clamour for even more. This requirement has been a fairly low priority one because of several reasons, the primary being the high disparity between the number of posts and pages for people. Posts often outnumber pages by 10 to 1, so the logical solution would be to assign the defaults to have the most common configuration.

Now, if I provide the capability to style generic single post layouts, very soon there will be one to differentiate between post formats etc.

Nonetheless, since I have already provided the capability to style single CPTs, I can see this becoming a standard feature. But it will not happen in the next one month (until I am done with my vacation at least).
Sayontan Sinha | http://mynethome.net/blog | http://www.aquoid.com/news
I don't do freelance work (for Suffusion or otherwise), so please don't contact me for quotes or offers.
sayontan
Site Admin
 
Posts: 10159
Joined: 15 Sep 2009, 16:39
Location: Houston, Texas

Re: Show Sidebar only on Posts [SOLVED]

Postby minty » 21 Jun 2012, 18:40

sayontan wrote:
Strictly speaking, the above changes are in a child theme - you don't have to change your code every time you update.


Duh. Of course. I'm using a child theme to give custom 404s and css; I'll add to it.

sayontan wrote:
Now, if I provide the capability to style generic single post layouts, very soon there will be one to differentiate between post formats etc.


But this is exactly what Suffusion needs: more options! It's so limited in what you can choose to change at the moment... :lol:
minty
 
Posts: 34
Joined: 21 Sep 2010, 21:55

Re: Show Sidebar only on Posts [SOLVED]

Postby drake » 21 Jun 2012, 20:18

minty wrote:
But this is exactly what Suffusion needs: more options! It's so limited in what you can choose to change at the moment... :lol:


This last it was a very goood one... I still laughing :))

I think that even Sayontan when is asking shortly about an option it stay a while and thinking: "Hmmm, yes, I am sure that I provide this option, but... where I put that button :? " :))
drake
 
Posts: 3779
Joined: 26 Jul 2011, 07:56
Location: Constanta, Romania

Re: Show Sidebar only on Posts [SOLVED]

Postby reza » 21 Jun 2012, 22:54

Next Suffusion version needs to be a complete CMS with content blocks and the like ;)
reza
 
Posts: 67
Joined: 20 Nov 2011, 19:37

Previous

Return to Support Requests

Who is online

Users browsing this forum: Andi, Google [Bot], HeiseFups and 7 guests