Tagged: page title
-
AuthorPosts
-
September 30, 2015 at 10:49 pm #511860
On pages like this, I want to remove the “Archive for Category:” while leaving the actual name of the category.
I tried following the instructions in this thread, but can’t get it to work. Maybe because I’m running a child theme? I created a replica of /framework/php/function-set-avia-frontend.php in the enfold-child directory and modified it as suggested, which is to say I changed this:
$output = __('Archive for date:','avia_framework')." ".single_cat_title('',false);
to this:
$output = __('','avia_framework')." ".single_cat_title('',false);
But it’s not changing on the front end. In the thread I linked the gal said she had to modify this in archive.php, but I can’t find that or anything like it within archive.php or template-archives.php.
<?php echo avia_title(false,false,avia_which_archive()); ?>
I’d also like to remove the Comments and Date from my Category Archives pages. I hope that’s in the same place, but if you could add instruction for that too I’d appreciate it.
Please and thanks.
September 30, 2015 at 10:53 pm #511861I also tried the advice recommended here which seems straightforward.
Go to your theme directory and open up archive.php. Somewhere in that file will be written “Archive for category <?php single_cat_title(); ?>” replace that with the text of your choosing.
But archive.php does not include any mentions of single_cat_title();.
I’m sure I’m missing something really obvious and easy that’s gonna make me look like a goof, but have given up on avoiding that.
October 1, 2015 at 7:35 pm #512385Hey!
That file is not a template file so it’s not going to work in your child theme. Instead you can copy the whole function since it’s wrapped in function_exists calls to your child theme functions.php file.
function avia_which_archive() { $output = ""; if ( is_category() ) { $output = __('Archive for category:','avia_framework')." ".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 = __('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; } 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; }
And edit it that way.
Best regards,
ElliottOctober 1, 2015 at 7:51 pm #512394Thanks Elliott. Good to know. I’m new to the use of functions.php for stuff like that. Very good to know.
I actually just came up with a different less back-end-hacky solution that I love, and probably should have thought of sooner, lol.
I created a custom “Page” that is just the way I want it — totally custom page title, page-specific sidebar, meta hidden by CSS, etc., and set up a redirect from the actual category page (http://dev.solacesystems.com/category/integration-guides/) to my custom page (http://dev.solacesystems.com/docs/integration-guides/)
Works like a charm, and gives me a lot more flexibility.
You can close this ticket, thanks.
-
AuthorPosts
- The topic ‘Remove "Archive for Category:" from Archive Page Titles’ is closed to new replies.