Viewing 16 posts - 1 through 16 (of 16 total)
  • Author
    Posts
  • #290127

    I came across this instruction in this support forum to add this code to functions.php..when enable it removes the Prefix Archives for tax if( is_category( ) )

    add_filter(‘avf_which_archive_output’,’avf_remove_which_archive’, 10, 3);

    add_filter(‘avf_which_archive_output’,’avf_remove_which_archive’, 10, 3);

    function avf_remove_which_archive($output) {
    if ( is_category() ) {
    $output = __(”,’avia_framework’).” “.single_cat_title(”,false);
    }

    return $output;
    }

    I would like to use this or something similar for other Tax that I have created. Do you know if that is possible with tax label or will only category work in the function.php in this theme. (i.e. other tax are not theme specific and could break site ?)

    If so, is there an alternate way to always remove the Archieve prefix

    thanks

    Ed

    #290534

    Hi Ed!

    You can use the is_tax conditional: http://codex.wordpress.org/Function_Reference/is_tax instead of is_category(). Use it like:

    
    add_filter('avf_which_archive_output', 'avf_remove_which_archive_output', 10, 1);
    
    function avf_remove_which_archive_output($output) {
    	$output = "";
    	
    	if(is_tax('portfolio_entries'))
    	{
    		$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
    		$output = $term->name;
    	}
    	
    	return $output;
    }
    

    The code above will remove the “Archive” prefix from all archive pages of the portfolio taxonomy. You can also use the second parameter to specify a special term/category of this taxonomy – i.e. is_tax(‘portfolio_entries’, ‘Books’) would just affect the term archive page of the portfolio category “Books”.

    Best regards,
    Peter

    #290544

    Thanks,

    Can I use this function code that you have provided as written in Enfold without any modifications ?

    Ed

    #290581

    Hi!

    Yes, if you just want to remove the “Archive” prefix from all archive pages of the portfolio taxonomy. If you want to use it with another taxonomy replace “portfolio_entries” with your custom taxonomy name. You can also use it for more than one taxonomy like:

    
    if(is_tax('portfolio_entries') || is_tax('my_ustom_taxonomy'))
    

    Best regards,
    Peter

    #290590

    How would I use this for category and its children ?

    if(is_tax(‘category_entries’) or like above if( is_category() )

    thanks

    #290619

    Peter,

    This code removes all the info, I set the if(is_tax(‘portfolio_entries’) to if(is_tax(‘category’))

    The banner originally reads:
    Archive for category: Wildlife Images

    Using your code it reads:
    null

    I want it to read:
    Wildlife Images

    #290623

    Your code also wipes out all different tax in the banner, The code is not selective for a unique tax. It wipes out 12 different tax that I have set up.. Whihc is okay, as I don’t want archive at all, but I’l like to have the Tax Description visible

    This is without the function code enabled:
    http://fritzimages.com/blog/category/photography/wildlife-image/

    Archive for category: Wildlife Images
    Archive for :Recommendation

    #290657

    this is where I want to remove “Archive for category;” but still keep Wildlife Images
    http://prntscr.com/4230yj

    #290737

    I have tried for the pst few hours the function.pho code you provided.
    it does not work at all.
    if(is_tax(‘category”)) does not work, on category or any other tax.

    I start out with this: and I want to remove, “archive for categories” and have only “wildlife images”
    http://prntscr.com/425obq

    using this function code provided
    http://prntscr.com/425no4

    all I get is for output:
    http://prntscr.com/425nul

    Interesting enough, this code provided by a support participant
    http://prntscr.com/425obq

    makes the correct output
    http://prntscr.com/425pjt

    the problems is that it only works on category……
    I don’t know how to modify it for other tax

    Do you ?

    #290738

    I found this function code, it however does not work for category
    add_filter(‘avf_which_archive_output’, ‘avf_remove_which_archive_output’, 10, 1);

    function avf_remove_which_archive_output($output) {
    $output = “”;

    if(is_tax())
    {
    $term = get_term_by( ‘slug’, get_query_var( ‘term’ ), get_query_var( ‘taxonomy’ ) );
    $output = __(”,’avia_framework’).” “.$term->name;
    }

    return $output;
    }

    I tried to various changes to the if(is_tax()) but could not get it to work for category

    What I need is a code that is a combination, one for tax f(is_tax()) and one for if ( is_category() )

    any suggestions ??

    thanks

    #290753

    Hi!

    is_tax() will not work on standard category archive pages. In your first post you asked how you can use this code with a custom taxonomy and I thought you don’t want to use it with post categories. If you want to use it with taxonomies/terms and post categories use it like:

    
    add_filter('avf_which_archive_output', 'avf_remove_which_archive_output', 10, 1);
    
    function avf_remove_which_archive_output($output) {
    	$output = "";
    	
    	if(is_tax('portfolio_entries') || is_category())
    	{
    		$term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) );
    		$output = $term->name;
    	}
    	
    	return $output;
    }
    

    The code will affect all archives of the taxonomy “portfolio_entries” and all post category archives.

    Cheers!
    Peter

    #290782

    Thanks, I tried your code and it did not work

    code used
    http://prntscr.com/427nm3

    result
    http://prntscr.com/427oxd

    #290784

    I also modified code just for category and it did not work

    code used
    http://prntscr.com/427pks

    results
    http://prntscr.com/427qs5

    #290785

    I modified code just for tax

    code used
    http://prntscr.com/427r8f

    results: it works
    http://prntscr.com/427r8f

    #290786

    Any ideas why this code does not work for category ?

    #291167

    Hey!

    Because is_tax() will not work for standard post categories. You must use is_category() for post archives. The documentation: http://codex.wordpress.org/Function_Reference/is_tax mentions this limitation: “Note that is_tax() returns false on category archives and tag archives. You should use is_category() and is_tag() respectively when checking for category and tag archives.”

    Cheers!
    Peter

Viewing 16 posts - 1 through 16 (of 16 total)
  • The topic ‘Remove "Archive" in Theme for all Tax not just category’ is closed to new replies.