-
AuthorPosts
-
January 27, 2015 at 11:07 am #386118
I have several different users on my site and each has their own customized sidebar for their site. However the users do not have much of a technical background and I want to make posting for them as easy as possible. Is it possible to set up a default sidebar for some of the users that is different for each one?
Also, each user has their own category, so if the sidebar could be set by category this would also work perhaps even better.
Perhaps there is a custom css I could insert for one user, for example, as I know this is not in the normal settings options.
- This topic was modified 9 years, 10 months ago by bingisser.
January 27, 2015 at 6:12 pm #386453Hi bingisser!
I’m not really sure I understand. Your trying to change the sidebar of one of your pages based on if a certain user is logged in?
Can you send us a link to the page so we can get a better idea?
Best regards,
ElliottJanuary 27, 2015 at 6:25 pm #386477No, I’m trying to make it so that a certain author or category can have a default sidebar.
January 28, 2015 at 9:01 pm #387366Hi!
Open up /enfold/sidebar.php and on line 44 you should see this.
if($custom_sidebar)
Add this above it.
if ( is_author() ) { $custom_sidebar = "author"; } if ( is_category() ) { $custom_sidebar = "category"; }
And then create two new widget areas in Dashboard > Appearance > Widgets named “author” and “category”.
Regards,
ElliottJanuary 29, 2015 at 1:43 pm #387675This reply has been marked as private.January 30, 2015 at 9:30 pm #388517Hey!
It seems to be working fine. I added a meta widget to only the Vern widget area and it’s only displaying in your Vern category archives.
Regards,
ElliottJanuary 30, 2015 at 9:39 pm #388525I think it is working because I have manually set all the post to have that sidebar. What I was looking for is when I create a new post that it sets correct sidebar by default. I have inserted the code, but when I create a new post in that category it uses simply the “Default Sidebars” which does not show the correct one. Does that make sense?
February 1, 2015 at 9:37 am #388977Hi!
If you want to show a specific widget on archive pages, please use the following plugin.
https://wordpress.org/plugins/widget-logic/
Cheers!
IsmaelFebruary 1, 2015 at 9:49 am #388981This might work, but I’m still wondering why the code above does not work. The goal is to get one category to show one sidebar by default.
February 2, 2015 at 7:52 pm #389602Hey!
The archives are going to use the “Sidebar Blog” widget area by default. You can override that for each category using the code sample in my previous posts but the “Displayed Everywhere” widget area is still going to display. If you do not want that then you’ll want to remove the widgets you have set to the “Displayed Everywhere” widget area and add them separately to each. Or you can use the plugin Ismael posted.
Regards,
ElliottFebruary 2, 2015 at 8:02 pm #389615This reply has been marked as private.February 3, 2015 at 8:06 pm #390323Hey!
I’m not sure what you mean. The “vern” widget area you have created is displaying on your vern category archives correctly.
Take some screenshots and highlight what your trying to do so we can get a better idea.
Regards,
Elliott- This reply was modified 9 years, 9 months ago by Elliott.
February 3, 2015 at 8:31 pm #390345This reply has been marked as private.February 4, 2015 at 9:14 pm #390924Hi!
So your talking about the single posts then instead of the category archives? In this case you need to use the in_category conditional check, http://codex.wordpress.org/Function_Reference/in_category, instead of is_category.
Regards,
ElliottMay 22, 2019 at 9:50 pm #1103465Hi Enfold Support,
On a related topic, is it possible to remove sidebars from posts of specific categories? We have different post types (by category) e.g. blog posts, press release posts, article posts, event posts, etc. Currently on our press release posts we don’t want a side bar. Instead of selecting the “no sidebar layout” in the avia builder widget, we’d rather simply have all press release posts not contain a sidebar. Is this possible through a functions.php or sidebar.php update in our child theme?Also, we’d like to keep the same left aligned layout of the post. We noticed that if we manually select on each post “No Sidebar Layout”, the post content becomes centered with an empty featured image placeholder at the top.
Thanks in advance for your help!
-EMay 23, 2019 at 2:48 pm #1103676Hi Eric,
Unfortunately, it would require quite some time and customization of the theme to achieve this, so I am sorry to tell you that this is not covered by our support. However, if it’s really important for you to get this done, you can always hire a freelancer to do the job for you :)
Best regards,
VictoriaMay 24, 2019 at 7:39 pm #1104011Victoria, if you’re able to provide a solution to make a specific sidebar appear based on the sidebar category (see above in Elliot’s response), how is it we can’t simply have the entire sidebar disappear by updating the sidebar.php file with a similar snippet of code?
Seems there could be a “display: ‘none’ ” script to make this happen.May 24, 2019 at 7:41 pm #1104012Also, how can we update the no sidebar post template to align left similar to how the with sidebar template layout? Thank you!
May 28, 2019 at 7:50 am #1104720Hi,
Thanks for the update.
Have you tried editing the single.php file? Just wrap this line of code in a conditional function.
//get the sidebar get_sidebar();
// https://codex.wordpress.org/Function_Reference/has_category
Best regards,
IsmaelMay 30, 2019 at 9:15 pm #1105498Thanks Ismael! We’ll give it a shot and let you know how it goes.
May 30, 2019 at 9:16 pm #1105499Regarding the layout for posts with no sidebar, how can we keep the content to be aligned left similar to how the the layout is when the sidebar is present? Thanks!
June 3, 2019 at 3:30 am #1106536Hi,
Thank you for the update.
You can use this css code to change the style of the full width posts.
#top .fullsize .template-blog .post .entry-content-wrapper > * { max-width: 100%; margin-left: 0; margin-right: 0; } #top .fullsize .template-blog .post .entry-content-wrapper { text-align: left; max-width: 800px; margin: 0; }
Best regards,
Ismael -
AuthorPosts
- You must be logged in to reply to this topic.