• Hi there

    I’ve tried following the advice here (https://wordpress.org/support/topic/templates-pages-for-displaying-usersauthors) for using my own template to display the output of the user tags.

    This is the code that I have entered into my functions.php file, and it doesn’t work. I’m not sure what I’ve missed. The template file is an exact copy of the default template from the plugin for testing purposes.

    remove_filter( 'taxonomy_template', 'get_custom_taxonomy_template' );
    
    add_filter( 'taxonomy_template', 'gsis_get_custom_taxonomy_template' );
    
    function gsis_get_custom_taxonomy_template($template = '') {
    
     $taxonomy = get_query_var( 'taxonomy' );
    
    	if ( strpos( $taxonomy, 'wp_user_' ) !== false ) {
    		$taxonomy_template = get_template_directory() . '/templates/user-taxonomy-template.php';
    		$file_headers      = @get_headers( $taxonomy_template );
    		if ( $file_headers[0] != 'HTTP/1.0 404 Not Found' ) {
    			return $taxonomy_template;
    		}
    
    	}
    
    	return $template;
    
    }

    Any advice would be much appreciated.

    https://wordpress.org/plugins/user-tags/

  • The topic ‘Template Pages’ is closed to new replies.