-
AuthorPosts
-
July 24, 2019 at 9:53 am #1121433
Hello,
I want to hide “Archive for:” in category pages. I found the appropriate code in this file: function-set-avia-frontend.php. My question: How do I get my changes in the child theme ?What I tried:
– Create a shortcode folder and save the file in it
– Added the function for the shortcode folder
.. unfortunately that does not workJuly 24, 2019 at 5:15 pm #1121631Hey frankeee,
What you tried is basically to replace ALB element that’s why it’s not working.
To replace this in your child theme just copy the whole avia_which_archive function, don’t include if(!function_exists(‘avia_which_archive’)) and paste it on your child theme’s functions.php.
Then tweak the function. Hope it helps :)Best regards,
NikkoJuly 25, 2019 at 8:47 am #1121836Hey Nikko,
thanks for your hint! I tried it:add_filter('Tag Archive for:','avia_framework', 10, 3); function avia_framework($output) { { $output = __('NOTHING','avia_framework')." ".$term->name; } return $output; }
… but it does not work. This is the original output :
$output = __('Tag Archive for:','avia_framework')." ".single_tag_title('',false); } elseif(is_tax()) { $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); $output = __('Archive for:','avia_framework')." ".$term->name; }
Is my function faulty?
July 26, 2019 at 6:43 am #1122096Hi frankeee,
Yes, I think there are some extra curly braces, those are used only when there are functions or conditional statements like if/else.
Can you try this:function avia_which_archive() { $output = __('NOTHING','avia_framework')." ".$term->name; return $output; }
Best regards,
NikkoJuly 26, 2019 at 10:30 am #1122122.. O.K. this is working – thanks! But the name of the category has disappeared too!
Actually, only the “Archive for:” should disappear not the name of the category. If I modify the code in function-set-avia-frontend.php in such a way:
elseif(is_tax()) { $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); $output = __(':','avia_framework')." ".$term->name;
… I come to the right output. Question: is this possible in the function?
July 26, 2019 at 6:11 pm #1122195Hi frankeee,
Just to be sure you can just copy the whole function and pick only that part that has Archive for, for example this one:
$output = __('Archive for:','avia_framework')." ".$term->name;
just replace it with:
$output = $term->name;
Best regards,
NikkoJuly 29, 2019 at 7:53 am #1122654sorry, I’m not a php programmer. but if I understood it correctly, the function must look like this:
function avia_which_archive () { $ output = $ term-> name; return $ output; }
… the problem unfortunately remains the same (name of the category will not display). Can you please have a closer look? I will give you login credentials in private content
July 29, 2019 at 9:43 am #1122673Hi frankeee,
Thanks for giving us admin access. I have added this code in your functions.php (I just tweak the part for category and taxonomy):
function avia_which_archive() { $output = ""; if ( is_category() ) { $output = single_cat_title('',false); } elseif (is_day()) { $output = __('Archive for date:','avia_framework')." ".get_the_time( __('F jS, Y','avia_framework') ); } elseif (is_month()) { $output = __('Archive for month:','avia_framework')." ".get_the_time( __('F, Y','avia_framework') ); } elseif (is_year()) { $output = __('Archive for year:','avia_framework')." ".get_the_time( __('Y','avia_framework') ); } elseif (is_search()) { global $wp_query; if(!empty($wp_query->found_posts)) { if($wp_query->found_posts > 1) { $output = $wp_query->found_posts ." ". __('search results for:','avia_framework')." ".esc_attr( get_search_query() ); } else { $output = $wp_query->found_posts ." ". __('search result for:','avia_framework')." ".esc_attr( get_search_query() ); } } else { if(!empty($_GET['s'])) { $output = __('Search results for:','avia_framework')." ".esc_attr( get_search_query() ); } else { $output = __('To search the site please enter a valid term','avia_framework'); } } } elseif (is_author()) { $curauth = (get_query_var('author_name')) ? get_user_by('slug', get_query_var('author_name')) : get_userdata(get_query_var('author')); $output = __('Author Archive','avia_framework')." "; if(isset($curauth->nickname) && isset($curauth->ID)) { $name = apply_filters('avf_author_nickname', $curauth->nickname, $curauth->ID); $output .= __('for:','avia_framework') ." ". $name; } } elseif (is_tag()) { $output = single_tag_title('',false); } elseif(is_tax()) { $term = get_term_by( 'slug', get_query_var( 'term' ), get_query_var( 'taxonomy' ) ); $output = $term->name; } else { $output = __('Archives','avia_framework')." "; } if (isset($_GET['paged']) && !empty($_GET['paged'])) { $output .= " (".__('Page','avia_framework')." ".$_GET['paged'].")"; } $output = apply_filters('avf_which_archive_output', $output); return $output; }
Best regards,
NikkoJuly 29, 2019 at 9:56 am #1122678… nice – it´s working!
Quite a lot of code to hide “Archive for:”. Anyway thanks a lot for your support!July 29, 2019 at 11:52 am #1122717Hi frankeee,
Yes, that quite some code there but it’s necessary to make sure it’s the right title for the right pages :D
We’re glad that we could help
Thanks for using Enfold and have a great day!Best regards,
Nikko -
AuthorPosts
- The topic ‘Hide Archive for:’ is closed to new replies.