Tagged: x
-
AuthorPosts
-
February 6, 2017 at 12:01 pm #1359988
mcphotoParticipantHere’s what I’ve got – this site is in development:
http://www.davidwgilbert.com/2017/
Here’s the structure we have going, might help you find our issue:
We have two categories of blog posts – “style” category populates the blog page; we don’t want a sidebar here, and it displays fine, getting no sidebar by using “full width” in the customizer, everything good:
http://davidwgilbert.com/2017/style/
“Projects” category appears on a category page, this is more for client PR – but it’s displaying a sidebar:
http://davidwgilbert.com/2017/category/projects/
We’re using woo commerce with shopping cart stuff disabled to show their house-brand products as a catalog (but no ordering needed, woo worked great to organize and display products) – so this is a cornerstone page with links to categories (works fine):
http://davidwgilbert.com/2017/the-sheffield-collection/
This has image links to woo commerce product category pages – not cornerstone pages, they’re woo categories (works fine):
http://davidwgilbert.com/2017/product-category/dining-tables/
Each product link goes to a woo commerce page for individual products:
http://davidwgilbert.com/2017/product/counter-height-table/
I needed a custom sidebar for each individual product page to show the product categories only – I found some code in this forum and it’s in functions.php in my child theme. This works fine as well.
So, everything works well except for two problems –
On the “projects” page (which is a blog post category page), I’m getting the sidebar intended for individual product pages. I need this to go away, but remain on product pages. I think it has something to do with the code in functions.php?
And on the homepage and many cornerstone pages, I’m using the “recent posts” shortcode, with the category set to “Style” – but once I added the custom php, this now just displays all blog posts and ignores the category altogether. (I tested this by changing creation dates on posts – it’s just showing all posts in order and not displaying only one category).
So, just two issues: lose the side bar on projects page
And get the recent posts shortcode to display only one category.
Thanks for any help with this!
February 6, 2017 at 12:01 pm #1359991
mcphotoParticipantThis reply has been marked as private.February 6, 2017 at 2:19 pm #1360137
Nabeel AModeratorHi there,
Thanks for writing in!
1. To hide the sidebar on the Projects page, add the following code in your Customizer via Appearance > Customize > Custom > Edit Global CSS:
.category-projects .x-sidebar { display: none !important; } .x-main { width: 100% !important; }2. You can filter posts by category in Recent Posts shortcode for example:
[recent_posts count="1" orientation="vertical" category="style"]This should work as expected but if you’re using a custom code then please provide us with the code so we can take a look.
Thanks!
February 6, 2017 at 4:14 pm #1360262
mcphotoParticipant1. To hide the sidebar on the Projects page, add the following code in your Customizer via Appearance > Customize > Custom > Edit Global CSS:
That worked, but the “width:100%;” has pushed the individual product pages to full width and dropped the sidebar to the next line (example: http://davidwgilbert.com/2017/product/counter-height-table/). Played with this but can’t figure out how to get .x-main to only apply to “.category-projects .x-sidebar”
2. You can filter posts by category in Recent Posts shortcode for example:
[recent_posts count=”1″ orientation=”vertical” category=”style”]
I’m using the built-in shortcode from cornerstone, but it’s ignoring categories, image attached.
February 6, 2017 at 11:43 pm #1360698
ChristopherModeratorHi there,
Please update this code :
.x-main { width: 100% !important; } .category-projects .x-sidebar { display: none !important; }to :
.product-template-default.single.single-product .x-main { width: 100% !important; } .product-template-default.single.single-product .x-sidebar { display: none !important; }Please remove quotes from category, it should be
style.Hope it helps.
February 7, 2017 at 3:48 pm #1361811
mcphotoParticipantPlease update this code :
That worked, but I had to leave the original fix and then add this to it vs. replacing, seems to be fine on all affected pages.
Please remove quotes from category, it should be style.
When I remove the quotes, the shortcode doesn’t display anything. If I only put one quote on either side, it displays but shows all posts; if I put quotes on both sides, same thing. I can’t get it to only display posts from the “Style” category.
February 8, 2017 at 3:20 am #1362526
LelyModeratorHi There,
Please use this code instead:
[recent_posts count="1" orientation="vertical" category="blog"]
Your style category has blog slug. We have to use the slug on the category option.Hope this helps.
February 8, 2017 at 9:03 am #1362882
mcphotoParticipantThanks, that did it – didn’t know the category came from the slug, I’ll remember that down the line.
February 8, 2017 at 9:57 am #1362971
RahulModeratorGlad to hear it!
Feel free to ask us again.
-
AuthorPosts
- <script> jQuery(function($){ $("#no-reply-1359988 .bbp-template-notice, .bbp-no-topic .bbp-template-notice").removeClass('bbp-template-notice'); }); </script>
