• Hi,

    I know about the child_of parameter, and I wonder if it’s possible to use something like “current” as a placeholder.

    What I actually need is a way to only show tags of the current category, because it makes more sense for visitors to drill down their selection that way.

    Is this already possible, or would it be feasible to implement for future versions?

    Regards

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author WPKube

    (@wpkube)

    Hi @schnipsel13

    Tags and categories aren’t connected. Or did you mean to show the subcategories of the shown category (on a category archive page)?

    Thread Starter Shnipsel

    (@schnipsel13)

    I mean to show tags used by the posts listed on a category archive page.

    Plugin Author WPKube

    (@wpkube)

    Ah, show the tags of all the posts shown on the current category archive page.

    Will add on the to do list, but can’t say for sure when it would be released. If it’s urgent, best to hire someone to develop such functionality.

    Thread Starter Shnipsel

    (@schnipsel13)

    Hi,
    I’ve created a solution for taking current loop posts into account. Perhaps you want to check it out. It’s working well in my case.

    Replace the whole if-block in cool-tag-cloud.php@71 with this:

    if ( $l_tag_params['on_single_display'] == 'local') {
    			
    			if (is_archive()) {
    				rewind_posts();
    				if (have_posts()) {
    										
    					$l_tag_params['include'] = [];
    					
    					while (have_posts()) {
    						the_post();
    					
    						$posttags = wp_get_post_terms( get_the_ID(), $l_tag_params['taxonomy'], array( 'fields' => 'ids' ) );
    						
    						if ($posttags) {
    							
    							foreach($posttags as $tag) {
    								$l_tag_params['include'][$tag] = $tag;
    							}
    						}
    					}
    				}
    
    				wp_reset_postdata();  
    				
    			}else if ( is_single() || is_singular( array( 'post', 'page' ) ) ) {
    				$tag_ids = wp_get_post_terms( get_the_ID(), $l_tag_params['taxonomy'], array( 'fields' => 'ids' ) );
    				if ( empty( $tag_ids ) ) {
    					$show = false;
    				}
    				if ( ! empty( $l_tag_params['exclude'] ) ) {
    					$exlude_tags = explode( ',', str_replace( ' ', '', $l_tag_params['exclude'] ) );
    					foreach ( $exlude_tags as $exlude_tag ) {
    						foreach ( $tag_ids as $tag_key => $tag_id ) {
    							if ( $tag_id == $exlude_tag ) {
    								unset( $tag_ids[$tag_key] );
    							}
    						}
    					}
    				}
    				$l_tag_params['include'] = $tag_ids;				
    			}
    		}
    Plugin Author WPKube

    (@wpkube)

    Hi @schnipsel13

    Thanks for sharing the solutions.

    Happy Holidays and wish you all the best in 2021.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Feature: show Tags of current archive’ is closed to new replies.