Tagged: child theme, continue reading
- This topic has 24 replies, 3 voices, and was last updated 10 years, 11 months ago by Jaime.
-
AuthorPosts
-
November 10, 2013 at 1:22 am #17029TrishahMember
I simply want to change the words “Continue reading” to “More”.
I am using a child theme to catchbox parent. I see that the “Continue reading” text is being generated in the parent functions.php line 398. I want to make changes in my child theme so it won’t change when parent theme updates.
I have tried using different “remove_action” code in my child functions.php but I keep getting the error about you can’t re-declare the function:
Fatal error: Cannot redeclare catchbox_continue_reading_link()
I’m guessing because there is no action declared in the parent function?
How do I change these words using only my child theme?
November 10, 2013 at 3:12 am #17034SakinKeymaster@Trishah: If you are using Catch Box Pro then there is easy option to change it from “Appearance => Theme Options => Excerpt/More Tag Settings”. Read Theme instructions for more details http://catchthemes.com/theme-instructions/catch-box-pro
But sorry Catch Box Free theme doesn’t have that option. To make that work in child theme, we need to update the theme and we will do that in new version. For now you edit the core theme and change
/** * Returns a "Continue Reading" link for excerpts */ function catchbox_continue_reading_link() { return ' <a class="more-link" href="'. esc_url( get_permalink() ) . '">' . __( 'Continue reading <span class="meta-nav">→</span>', 'catchbox' ) . '</a>'; }
to
if ( ! function_exists( 'catchbox_continue_reading_link' ) ) : /** * Returns a "Continue Reading" link for excerpts */ function catchbox_continue_reading_link() { return ' <a class="more-link" href="'. esc_url( get_permalink() ) . '">' . __( 'Continue reading <span class="meta-nav">→</span>', 'catchbox' ) . '</a>'; } endif;
Then your function catchbox_continue_reading_link() in child theme functions.php will work.
We will be adding this in core theme in upcoming update. So, for now you can change it. Sorry for the trouble.
November 10, 2013 at 11:04 pm #17062TrishahMemberHello Sakin,
Thank you for this solution. It works perfect!
I use catchbox as my parent theme on 90% of the sites I design because of it’s features, like integrated tinymenu that I don’t have to add, and the flexibility of the template system you’ve established. I also respect you’re quick and considerate support for your themes. So, thank you again for your help!
Trishah
November 21, 2013 at 6:30 am #17455TrishahMemberHello Sakin,
As I base a lot of my child themes on CatchBox Free I don’t really need your Pro version as I can tweak the free version myself. But I would like to send you something whenever I do use your free theme as it has helped me greatly. Can you tell me your PayPal address so I can send you a donation?
November 21, 2013 at 12:37 pm #17460SakinKeymaster@Trishah: Thanks for your appreciation and yes we are absolute fine that you like to use Catch Box Free theme. Here is donation link: http://catchthemes.com/donate/
November 22, 2013 at 12:38 am #17488JaimeMemberMy problem is very similar: I’m unable to change the “Continue reading →” text with a .po file, the CodeStyling Localization plugin didn’t work, either, so I decided to place a modified php file in my child catalogue. I used the code that Sakin gave above – no result.
I’m using the free version of Catch Evolution, the file I modified was catchevolution-functions.php, in the above code I only replaced “catchbox” with “catchevolution”.
Since I don’t know php, most probably there’s something I did wrong. What was it?
Greetings,
JaimeNovember 22, 2013 at 3:12 am #17503TrishahMemberThank you Sakin for the donate button. I’ve sent you something for the last 3 websites I developed with your Catch Box free theme. FYI: Did you know that the domain name catchbox.com is still available? Might be a good purchase to own that name 😀
November 22, 2013 at 3:17 am #17504TrishahMemberJaime, in Catch Box free I just did what Sakin said to do, go into the functions.php of the parent theme folder replace the
/**
* Returns a “Continue Reading” link for excerpts
*/code as he suggested. Then you can add the following code to your child functions.php with whatever wording you want.
/** * Returns a "Continue Reading" link for excerpts */ function catchbox_continue_reading_link() { return ' <a class="more-link" href="'. esc_url( get_permalink() ) . '">' . __( 'More<span class="meta-nav">…</span>', 'catchbox' ) . '</a>'; }
The above code makes a link that says “More…” and links to the single post.
Hope this helps.
November 22, 2013 at 5:45 am #17507JaimeMemberBingo! It did work, thank you very much.
I’m a bit surprised and disappointed that I had to modify a parent php file – I really liked the concept of a child thanks to which you leave the original (=parent) files untouched. And of course when I install a new version of the theme the changes will be lost. Nevertheless, for the time being I’m glad to have solved this little problem. Thank you for your help.
And speaking about problems… do you know where the copyright notice is generated? I’m quite sure it is not within the theme, it must be “higher” (I suspect WordPress itself). What I want to do is to localize the “Powered by: WordPress | Theme: Catch Evolution” message, but neither a .po file nor the specialized plugin can help.
Greetings,
JaimeNovember 22, 2013 at 6:15 am #17508JaimeMemberSilly me! I’ve just noticed that in the Theme options menu there’s an “Excerpt / More tag settings” tab where the “Continue reading” message can be modified. Definitely much easier than changing the php file 🙂
(The “powered by” problem still unresolved.)
Jaime
November 22, 2013 at 8:43 am #17509TrishahMemberHi Jaime,
I know you are not using Catch-Box for your current project, but I thought that you’d like to see how I start my child theme when I use Catch-Box free. What I do is start with stripping out a lot of the parent styling so I am left with a “blank canvas”. This may not be what you want to do but looking at this may give you a starting place for your next project.
Demo of Catch-Box Child
Child Theme: Catch-Box_Child_Basic_by_Trishah.com.zip
WordPress Codex: http://codex.wordpress.org/Child_ThemesOnce you get your child theme activated the styling and coding in the child take priority over the parent. So, if you want to change something in the footer (like the copyright and “Powered by WP”), you copy footer.php from the parent into your child theme and alter it there 😀
And also, use FireFox and the plugin FireBug for making CSS changes… it saves a LOT of time.
November 22, 2013 at 10:46 pm #17533SakinKeymaster@Jaime: If you are using Catch Evolution Pro theme then you can edit you can edit the footer info from “Appearance => Theme Options => Footer Editor”. We don’t recommend you to change it in Free version as this is only means through which we get recognition for providing free theme and free support. Thanks.
yes, child theme is a great way to customize the theme.
@Trishah: Yes, child theme is great and best way to customize the theme. When I check in your sample child theme sytle.css, the theme name and description was it confusing. As you have added “Theme Name: Responsive Child Theme – XXX.com” and “Description: Responsive Child Theme – XXX.com – DO NOT REMOVE the Parent Theme: catch-box”The best will be
/* Theme Name: Catch Box Child Theme - yoursitename.com Description: Catch Box Child Theme - yoursitename.com - DO NOT REMOVE the Parent Theme: catch-box Author: Trishah at http://trishah.com Template: catch-box Version: 1.0 License: This theme is private licensed to one buyer, yoursitename.com, and is not transferable or sold without written permission from Trishah.com */
November 22, 2013 at 11:27 pm #17541TrishahMemberHello Sakin,
Yes I can see why it would look confusing to others so I have changed by child style.css to reflect your suggestions. Good call. 😀
Trishah
November 22, 2013 at 11:52 pm #17544SakinKeymasterHello Trishah,
Thanks now your style.css look better. One more suggestion. You can remove page.php and it’s not much worth adding it. But it will be great if you add in functions.php and add in the following. So, all the css changes can be added in style.css and all functions changes can be added from functions.php
<?php /** * Catch Box Child Theme functions, hooks and filter * * You can add in the function that you want to customize * You can also use acton hooks and filter to modify the fucntion */
November 23, 2013 at 12:13 am #17546TrishahMemberSakin,
Huh… I used to get an error when I used a child theme without at least one template file in it. Apparently that is no longer the case. cool.
I have removed the page.php and added a functions.php It includes functions to specify favicons for both the site and the admin as I find them very helpful. Also I think it’s a good example of how to use a child functions.php file.
November 23, 2013 at 12:32 am #17548SakinKeymaster@Trishah: Correction to your functions.php file. You should not use
bloginfo('stylesheet_directory')
instead you should useget_stylesheet_directory_uri()
in child theme. It’s clearly written here http://codex.wordpress.org/Function_Reference/bloginfoSo you should replace your current code
<link rel="shortcut icon" href="<?php echo bloginfo('stylesheet_directory') ?>/images/favicon.png" >
With the following Code
<link rel="shortcut icon" src="<?php echo get_stylesheet_directory_uri() ?>/images/favicon.png" />
November 23, 2013 at 1:15 am #17556TrishahMemberlol. I guess “what works” is not always the best way to do things. Thank you for the notes. It’s been fixed.
November 25, 2013 at 3:18 pm #17618JaimeMember@Sakin:
As I have written, I don’t want to REMOVE the copyright note, I want to LOCALIZE it. (I totally agree that a free motive’s author should be duly credited.)
My problem is that I don’t know where to look for the note (it seems to me that it is not included in footer.php and my modification of catchevolution-themeoptions-defaults.php has no effect.)
@Trishah:
Thank you very much for your help, in a free moment I’ll have a look at all the information you provided. And if I do not succeed in changing the copyright note, well, I think I can live with it 🙂December 10, 2013 at 9:20 pm #18111JaimeMemberSo… I was told to fiddle with the functions.php file ($catchevolution_options_defaults and $catchevolution_options_settings) to change what I wanted to change. And it did work… partially: I managed to translate the copyright notice into my language, but the WordPress and the theme information disappeared. It’s NOT what I wanted, but I’m already tired of this (or maybe I should say: I’ve spent too much time on this trifle) and I will probably leave it as it is now.
So, that’s how things backfire sometimes: Sakin wanted to protect visibility of the theme’s name but it looks that there’ll be no information about it at all, neither in English nor in any other language…
December 10, 2013 at 10:34 pm #18123 -
AuthorPosts
- The topic ‘How To Change "Continue Reading" text?’ is closed to new replies.