Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #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.

    #553109

    Hi CristianoBottone!

    Please refer to Ismael’s post here – https://kriesi.at/support/topic/category-in-magazine/#post-533010

    Regards,
    Yigit

    #553170

    Ok 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: Dogs

    What I have to show is:

    Dogs
    Delicious food for your best friend

    The Category is a fixed parameter at the moment, always the same for all the articles, the subCategory changes.
    Thank you for you help.

    #554806

    Hey!

    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,
    Ismael

    #554950

    Thank 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.

    #555352

    Hi!

    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!
    Ismael

    #555391

    Your right and I apologize. But now is perfect!
    Thank you Ismael.

    #555556

    Hi,

    Great, glad you got it fixed :-)

    Best regards,
    Rikard

Viewing 8 posts - 1 through 8 (of 8 total)
  • You must be logged in to reply to this topic.