More Tag

  • Admin

    Syahir Hakim

    #19612

    The same code applies. Just change the string inside that code with the string that you want to replace:

    // Change "Read the rest of this entry" link Button
    function graphene_filter_readmore( $translated, $original, $domain ) {
    $strings = array(
    'Read the rest of this entry »' => '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 );

    soapy

    #19613

    THANK YOU ALL!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    THIS IS REALLY APPRECIATED!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!

    soapy

    #19614

    LOL….I was a little premature there….because I’m getting the following error:

    Fatal error: Cannot redeclare graphene_filter_readmore() (previously declared in /home/delgreco/public_html/wp-content/themes/graphene-child/functions.php:15) in /home/delgreco/public_html/wp-content/themes/graphene-child/functions.php on line 38

    And here is my child theme functions.php:

    <?php
    function searchfilter($query) {

    if ($query->is_search) {
    $query->set('post_type',array('post'));
    }

    return $query;
    }
    add_filter('pre_get_posts','searchfilter');

    // Change "Continue Reading" 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 );

    // Change "Read the rest of this entry" link Button
    function graphene_filter_readmore( $translated, $original, $domain ) {
    $strings = array(
    'Read the rest of this entry »' => '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 );

    ?>

    Any ideas??

    Admin

    Syahir Hakim

    #19615

    The error is exactly what it says: you cannot redeclare the same function.

    Instead of copying the functions I posted above two times, do this instead:

    // Change some strings
    function graphene_filter_readmore( $translated, $original, $domain ) {
    $strings = array(
    'Continue reading &raquo;' => 'My New Text &raquo;',
    'Read the rest of this entry &raquo;' => 'My Other New Text &raquo;',
    );
    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 );

    soapy

    #19616

    Thank you very much Syahir

    Teun

    #19617

    That is really really helpful! I used this peace of code for more uses to change English into Dutch. There´s just one problem I encounter.

    When I added the following it worked:

    ‘1 comment’ => ‘1 reactie’,

    But when I add more of the same, only the first works:

    ‘1 comment’ => ‘1 reactie’,

    ‘2 comments’ => ‘2 reacties’,

    ‘3 comments’ => ‘3 reacties’,

    So ‘1 comment’ will change, but 2 and more comments won’t. Any ideas?

Viewing 6 posts - 21 through 26 (of 26 total)

  • You must be logged in to reply to this topic.