Hi Nuera,
The reason why it is not showing properly is because the open and close clause is wrong.
It should be {{dc:archive:meta key=“display_title”}}. I went ahead and change it for you.
Hope that helps.
Thank you.
Hi Nuera,
The reason why it is not showing properly is because the open and close clause is wrong.
It should be {{dc:archive:meta key=“display_title”}}. I went ahead and change it for you.
Hope that helps.
Thank you.
Hey Marc,
I think I was editing when you went in and changed it and so I likely just saved over your work. That said, I did add the clause in the way you featured it here and it’s still not displaying.
Sorry, thank you, and please advise… haha
Hi Neura,
I change it again and it is now working properly. I am also very sorry, it was my mistake because I make the dynamic content code Bold Text and it leads the clause into the wrong one. But for the future preferences here’s the correct way to add it here {{dc:archive:meta key="display_title"}}
.
Hope that helps.
Thank you.
You’re fantastic - thank you so much, all!
HI Neura,
You’re welcome! If you have any other concerns or clarifications regarding our theme features, feel free to open up a new thread.
Thank you.
Related follow-on question. Is there a way to make sure a layout is applied to subcategories?
For example:
https://brewsky.nueramarketing.com/product-category/wine/red-wine/
Hi Neura,
I don’t see an option that applies dynamically to all product subcategories. I suggest that you added it manually to your subcategories using the OR option and apply the same process to your other subcategories. See the example screenshot below.
Hope that helps.
Thank you.
Ok, I’ll give that a shot.
Hopefully last question- Is there any cornerstone element that can display a dynamic list/menu of subcategories? I’d like to create a nicer-looking page filter for the shop pages.
Hey Ruenel!
I’ve never used this element before so forgive my ignorance on how it functions. I have successfully found a way to display the categories, but I’m trying to display only the live Subcategories for a given Product Category within a dynamic layout.
I assume this is done through some kind of exception, as Marc_A suggested above, but I’m not seeing a method of displaying that.
Thanks!
Hi @Nuera,
It seems you are trying to show the Subcategories of current categories. If that is the case, you need to use the custom hook within your existing Looper Provider and pass the {{dc:term:id}} as a parameter to the custom hook function as explained in the following thread.
And you may need to change the function a little to get the JSON parameter that sends to the custom Hook function, please find that change in the below code.
$term_id = cs_dynamic_content( $args['parent_cat'] );
Reference Thread:
Hope it helps.
Thanks
HAHA Ok, so this graphic designer is hanging on as best he can here… Thank you so much!
Here is what I’ve got so far, but it’s not returning anything on the front end just yet.
You can see an example of the live page at: https://brewsky.nueramarketing.com/product-category/beer/
I’ll admit that I didn’t understand much from your last bit of instruction though, so forgive me if I’m omitting any critical details. Very much appreciated!
Hi @Nuera,
You need to add the JSON as shown in the screenshot given in my post.
{
"parent_post":"{{dc:term:id}}"
}
The code you have added into the JSON that should be used in the PHP code to fetch the parameter, and the code will look like that.
add_filter('cs_looper_custom_subcat', function($result, $args)
{
$term_id = cs_dynamic_content( $args['parent_cat'] );
$cat_args = array(
'hide_empty' => 1,
'child_of'=> $term_id,
'taxonomy' => 'product_cat',
);
$subcats = get_categories($cat_args);
return $subcats;
}, 10, 2);
Hope it helps.
Thanks
I think my confusion is where to place everything. Would it be possible for you to provide screencaps that are a little wider so I have better context of where to place the bits of code?
Sorry, I know it’s probably frustrating to deal with less-technical developers… hahah
Hi @Nuera,
No problem to describe you again, but the instructions are already given in the reference thread which I have given in my previous post. You need to add the PHP code into your child theme’s functions.php file. Then you need to select the Looper Provider type Custom and add the subcat as Hook and add the parameter into the Param section as shown in the following screenshot.
If you have any further confusion, I would suggest you to go through the reference thread in above posts.
Thanks
That makes sense, thanks for the clarification!
I have edited the functions.php and I have added the code in the JSON bit. It’s now displaying all of the subcategories which is a great step forward!
Now I just need the Subcategories to display based on the Category that’s selected. Right now it is simply displaying all of the subcategories instead of the specific subset.
I tried to reference the link you included earlier, but it is 404’ing, so feel free to resend if you have an active link and I’ll be more than happy to dive into it.
Hi Nuera,
I just check your setup and found out why they are not showing the specific subcategory of the main category. The main problem here is that the code you added in your child theme functions.php.
add_filter('cs_looper_custom_subcat', function($result, $args)
{
$term_id = cs_dynamic_content( $args['parent_cat'] );
$cat_args = array(
'hide_empty' => 1,
'child_of'=> $term_id,
'taxonomy' => 'product_cat',
);
$subcats = get_categories($cat_args);
return $subcats;
}, 10, 2);
The $term_id on that code is empty that’s why it is showing all the categories and subcategories. To fix your issue, please update your code to this one.
add_filter('cs_looper_custom_subcat', function($result, $args)
{
$category = get_queried_object();
$cat_args = array(
'hide_empty' => 1,
'child_of'=> $category->term_id,
'taxonomy' => 'product_cat',
);
$subcats = get_categories($cat_args);
return $subcats;
}, 10, 2);
That code will do the trick. It will display the sub-category of the specific main category.
Hope that helps.
Thank you.
WOOO!!! That’s PERFECT.
Thank you all so much!!!
You are most welcome!
This topic was automatically closed 10 days after the last reply. New replies are no longer allowed.