Hide certain tags in post meta

Community Forums Forums Design Tips and Tricks Hide certain tags in post meta

This topic is: not resolved

Tagged: ,

This topic contains 2 replies, has 2 voices, and was last updated by  braddalton 4 months, 2 weeks ago.

Viewing 3 posts - 1 through 3 (of 3 total)
  • Author
    Posts
  • #117657

    Jummul
    Participant
    Post count: 40

    Hi there!

    As you can see on the site in question (www.acupoflife.nl) there is a blog containing posts labeled with tags. These tags serve two purposes; first they tell the visitor what the post is about and give the visitor the option to click the tag so they can view more alike posts.

    Secondly, they are used in a php-script to order all the post in our archive (click on any of the categories above if you will). A post containing a tag that is linked to an archive will automatically be listed there.

    Now, the qu

    I stopped typing. Question: How can I hide certain tags from post meta. I want (need) to tag posts with a certain number of tags but want to be able to control what tags I show the audience.

    http://acupoflife.nl
    #117691

    braddalton
    Participant
    Post count: 10675

    You can modify the WordPress function which generates them in Genesis. ( Please do this in a child theme )

    add_shortcode( 'post_tags', 'genesis_post_tags_shortcode' );
    
    function genesis_post_tags_shortcode( $atts ) {
    
    	$defaults = array(
    		'after'  => '',
    		'before' => __( 'Tagged With: ', 'genesis' ),
    		'sep'    => ', ',
    	);
    	$atts = shortcode_atts( $defaults, $atts, 'post_tags' );
    
    	$tags = get_the_tag_list( $atts['before'], trim( $atts['sep'] ) . ' ', $atts['after'] );
    
    	//* Do nothing if no tags
    	if ( ! $tags )
    		return;
    
    	if ( genesis_html5() )
    		$output = sprintf( '<span %s>', genesis_attr( 'entry-tags' ) ) . $tags . '</span>';
    	else
    		$output = '<span class="tags">' . $tags . '</span>';
    
    	return apply_filters( 'genesis_post_tags_shortcode', $output, $atts );
    
    }
    

    #117729

    braddalton
    Participant
    Post count: 10675

    You may need to replace get_the_tag_list with a new WP_Query

    $args = array(
        'post_type' => 'post',
        'tax_query' => array(
            array(
                'taxonomy' => 'post_tag',
                'field' => 'id',
                'terms' => array( add comma seperated list of tag I.D's here ), 
                'operator' => 'NOT IN'
            )
        )
    );
    $query = new WP_Query( $args );
    
    

Viewing 3 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic.