More Tag
-
Sorry for empty post, I lost Internet access.
You can change the text by editing themes loop.php, but all will be lost when you update the theme.
I’m using codestyling localization so I simpy translated this in Croatian language, but if you want to change it without messing the theme files you have to add function in your child theme functions.php
I’m PHP numb, so… try reading some of this articles:
http://codex.wordpress.org/Customizing_the_Read_More#Designing_the_More_Tag
You can add this to your child theme functions.php file:
// Change "Read the rest of this entry" link Button
function graphene_filter_readmore( $translated, $original, $domain ) {
$strings = array(
'Continue reading »' => 'My New Text »',
);
if ( ! empty( $strings[$original] ) ) {
$translations = &get_translations_for_domain( $domain );
$translated = $translations->translate( $strings[$original] );
}
return $translated;
}
add_filter( 'gettext', 'graphene_filter_readmore', 10, 3 );You can, of course, change “My New Text” to whatever you like.
Thanks, I will try this when I get home.
One other question Josh, I’m pretty good with HTML and CSS….and I use firebug to troubleshoot when I need to find the name of a CSS element to modify it.
I don’t have much experience with PHP. My quesiton is….is there a way to determine the php code you need to modify when looking at something specific…just like there is with CSS and firebug??
Thanks Josh
Hey Josh,
I added the code to my child functions.php file….but it didn’t change anything. Any ideas why?
Here is my functions.php file:
<?php
function searchfilter($query) {
if ($query->is_search) {
$query->set('post_type',array('post'));
}
return $query;
}
add_filter('pre_get_posts','searchfilter');
// Change "Read the rest of this entry" link Button
function graphene_filter_readmore( $translated, $original, $domain ) {
$strings = array(
'Continue reading »' => 'My New Text »',
);
if ( ! empty( $strings[$original] ) ) {
$translations = &get_translations_for_domain( $domain );
$translated = $translations->translate( $strings[$original] );
}
return $translated;
}
add_filter( 'gettext', 'graphene_filter_readmore', 10, 3 );
?>Mod
is there a way to determine the php code you need to modify when looking at something specific…just like there is with CSS and firebug??
Interesting question. Since PHP generates HTML, you can’t really use Firebug or your browser’s “view source” function.
What I do is to keep a copy of both Graphene and WordPress on my desktop, so I can search through those files whenever I like with a text editor I’m familiar with (I like notepad++ for windoze and macpad for mac).
Mod
Have you tried changing this line
'Continue reading »' => 'My New Text »',to something like
'Continue reading »' => 'If you don't read this post a fairy will drop down dead »',or whatever you would like it to say.
The reference is from Peter Pan; you’re dealing with a literature teacher here — 🙂
- You must be logged in to reply to this topic.
