Tagged: archive page, archive.php, child theme, title
-
AuthorPosts
-
August 25, 2014 at 5:46 am #308597
I know that I previously saw a title at the top of the archive pages for post categories — probably author too. But I can’t find the category archive title on those pages anymore nor can I find a setting that turns this on or off:
1)) I want to have the title of the archive appear at the top of the post listeng for archives
2)) I would like to change the wording to say something like this:
Posted in: «category name»
Here’s a sample category archive page: http://worldri.de/VK9p0s
Yet I cannot find out where or how to do this.thanks,
MmD
- This topic was modified 10 years, 3 months ago by MacMyDays.
August 25, 2014 at 2:51 pm #308835Hey MacMyDays!
Please open up enfold/archive.php and replace:
<div class="category-term-description"> <?php echo term_description(); ?> </div>
with:
<h1 class="category_archive_title"> <?php single_cat_title( 'Posted in: ', true ); single_month_title( ' ', true ); ?> </h1> <div class="category-term-description"> <?php echo term_description(); ?> </div>
Regards,
PeterAugust 25, 2014 at 9:04 pm #308976Is there a way to use this same code for a ‘by year’ function? I tried single_year_title… but that didn’t work. I didn’t think it would be that easy but thought I’d give it a shot.
August 26, 2014 at 7:37 am #309148Hi!
There is no single_year_title function, you could try stripping the month from single_month_title:
preg_replace("/[^0-9,.]/", "", single_month_title( ' ', true ));
Cheers!
JosueAugust 27, 2014 at 12:46 am #309596Re: Changing the Page Title Text on Archive Pages.
1. If using a child theme, do I put a complete copy of archive.php in child theme to make changes?
2. Could you tell me the code I need if I want to substitute just the name of the category, for example “Event Video” instead of “Archive for category: Event Video”August 27, 2014 at 6:58 am #309671Hi!
1.) Yes, you can copy the archive.php file to the child theme folder.
2.) Add this on functions.php to change the category archive title:
add_filter('avf_which_archive_output','avf_change_which_archive', 10, 3); function avf_change_which_archive($output) { if(is_category()) { $output = __('','avia_framework').' '.single_cat_title('',false); } return $output; }
Regards,
IsmaelAugust 27, 2014 at 11:03 pm #310081To clarify my question.
I was thinking that the change was to be made in the archive.php – thus my question about putting a copy in the child theme.
Since you said to put the code in functions.php (in my child theme, I assume), is there a reason to put the archive.php in my child theme? Or should I just put the code in the child functions.php and call it a day?August 27, 2014 at 11:12 pm #310084Hey!
That depends on the change you want to do, if you the code Ismael suggested does what you need then it’s not necessary.
Cheers!
JosueMarch 28, 2020 at 3:09 pm #1198585sorry wrong page
- This reply was modified 4 years, 8 months ago by studiono.
March 29, 2020 at 6:54 pm #1198914Hi,
Thank you, we will close this now. Thank you for using Enfold.For your information, you can take a look at Enfold documentation here
For any other questions or issues, feel free to start new threads in the Enfold forum and we will gladly try to help you :)Best regards,
Mike -
AuthorPosts
- The topic ‘Archive Pages Title(s)’ is closed to new replies.