-
AuthorPosts
-
December 15, 2015 at 11:56 am #552921
I need to cancel the date appearing over the title.
I suppose I have to remove the line 583 on magazine.php (right?).And I’d like to see there (where the date appears now) the a specific sub category of the article, I know the mother category, the one I use to select the articles to show, and I have to get automatically the child category associated with each specific article.
Can you please help me with this?
Thank you.December 15, 2015 at 4:03 pm #553109Hi CristianoBottone!
Please refer to Ismael’s post here – https://kriesi.at/support/topic/category-in-magazine/#post-533010
Regards,
YigitDecember 15, 2015 at 5:16 pm #553170Ok thank you, quite there, but non exactly what I need.
Using that code I get the list of all the categories associated to the article.
What I’m trying to do is to check the sub categories of one specific category and show only the sub-category associated to the article.For instance:
Article title: Delicious food for your best friend
Category: Pets
SubCategory: DogsWhat I have to show is:
Dogs
Delicious food for your best friendThe Category is a fixed parameter at the moment, always the same for all the articles, the subCategory changes.
Thank you for you help.December 18, 2015 at 4:41 am #554806Hey!
Replace the code with this:
$categories = get_the_category($entry->ID); $cats = ''; foreach($categories as $categorieschild) { if (cat_is_ancestor_of(4, $categorieschild)) { $cats = $categorieschild->cat_name; }} $output .= "<span class='av-magazine-cats'>".$cats."</span>";
Look for the line “if (cat_is_ancestor_of(4, $categorieschild)) {“. Make sure that you change the value “4” to the id of the parent category “Pets”.
Best regards,
IsmaelDecember 18, 2015 at 2:15 pm #554950Thank you Ismael, but it doesn’t work.
No error but not cats appearing. If you check the url I attach (private), under the title “Acqua” the list of items contains portfolio elements wit the parent category “Luogo” ID41 and some sub-category. As you can see the sub-category don’t appear.
Best.
December 19, 2015 at 5:52 am #555352Hi!
You didn’t mention that you’re using portfolio items. The code is meant for default posts. Try this instead:
$categories = get_the_terms($entry->ID, 'portfolio_entries'); //var_dump($categories); $cats = ''; foreach($categories as $categorieschild) { if (term_is_ancestor_of(13, $categorieschild, 'portfolio_entries')) { $cats = $categorieschild->name; }}
Don’t forget to change the value (13) to the id of the parent category.
Cheers!
IsmaelDecember 19, 2015 at 11:33 am #555391Your right and I apologize. But now is perfect!
Thank you Ismael.December 20, 2015 at 7:12 am #555556 -
AuthorPosts
- You must be logged in to reply to this topic.