• Hi,
    thanks for this great plugin!

    My question: I have Posts for Events and Posts for Organizations (both
    standard post type). Assigned to the Posts are Categories such as the
    Parent Category “Events” or parent category “Organizations”. Child
    categories are something like: Music, Arts and so on. For both
    organizations and Events. There are also child categories that show the
    city where organizations are or events take place.

    Now I would like to output four separate loop-lists:

    1. A list of all cities where Events take place. When I click on
    Music-Event all assigned posts are shown (but without posts that are
    organizations).
    2. A list of all cities where there are organzations. When I click on
    Music-Organization all assigned posts are shown (but without posts that
    are events).
    3. A list of all categories of types of Events. When I click on
    Music-Event all assigned posts are shown (but without posts that are
    organizations).
    4. A list of all categories where of organzations – When I click on
    Music-Organization all assigned posts are shown (but without posts that
    are events).

    How would you do that? I didn’t succeed because every time I try to list
    the child categories of Organizations, also the children of Events are
    also shown and the other way around….

Viewing 7 replies - 1 through 7 (of 7 total)
  • Thread Starter desputin

    (@desputin)

    PS my code right now looks like this:

    
    [loop type=post and category=Events current=true orderby=name]
    [for each=category parents=false]
    [-for each=child]
    <ul>
     	<li>Kategorie: [each link]</li>
    </ul>
    [/-for]
    [/for]
    [/loop]

    But as I said I don’t only get the sub-categories for events but also the sub-categories of organizations with this, which I would like to avoid.

    Thread Starter desputin

    (@desputin)

    Can nobody help me with this?

    Is there a way of getting an output of all posts by a certain category that also caontain a certain tag?

    Also interested.
    Great post!

    Thread Starter desputin

    (@desputin)

    Now I solved my problem using a different solution. With the Addon “PHP Code Snippets” I insertet the following PHP-Code:

    
    <?php wp_list_categories( array(
            'orderby'            => 'id',
            'show_count'         => true,
            'use_desc_for_title' => false,
    'title_li'     => __("Cities/Places of Organizations:"),
            'child_of'           => 159
        ) ); ?>

    This simply lists all child categories of the parent category “Places of Organizations”. So now I have Parent categories for “Places of Organizations”, “Places of Events”, “Categories of Organizations” and “Categories of Events”. This is kind of complicated because now I have a ton of different parent and even more child categories, but it works just fine.

    • This reply was modified 5 years, 10 months ago by desputin.
    <ul>
    [for each=tribe_events_cat term=county children=true empty=false]
    		[if children]
    				[-for each=child order=ASC]
    						
    					<li>[each link]</li>
    			
    				[/-for]
    		[else]
    		[/if]
    [/for]
    	</ul>
    • This reply was modified 5 years, 6 months ago by tedhattemer.

    The code above works great with the “The Events Calendar” by Modern Tribe. I would like to suppress categories for of which there are no associated posts… any ideas given the code above?

    Nevermind, solved it:

    
    <ul>
    [for each=tribe_events_cat term=county children=true empty=false]
    		[if children]
    				[-for each=child order=ASC]
    		[loop exists type=tribe_events orderby=title]				
    					<li style="a:hover:purple">[each link]</li>
    			[/loop]
    				[/-for]
    		[else]
    		[/if]
    [/for]
    	</ul>
    
Viewing 7 replies - 1 through 7 (of 7 total)
  • The topic ‘Show child categories from just ONE Parent category’ is closed to new replies.