More Tag

  • sylvia

    #1236

    When I use the <!–more–> tag in a post, it creates a button that says something like “Continue reading this entry>>”. How can I modify what it says inside that button as I would like it to say something else?

    Thanks

    Luko

    #19593

    soapy

    #19594

    Luko,

    I see you tried to reply….unfortunately your post isn’t showing anything…

    Luko

    #19595

    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

    Josh

    #19596

    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.

    soapy

    #19597

    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

    soapy

    #19598

    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

    Kenneth John Odle

    #19599

    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).

    soapy

    #19600

    Thanks for you answer Ken. I need to start reading up on PHP to get familiar with it….then I’m sure it will all make sense.

    Do you know why the code Josh provided me won’t work? I wouldn’t even know where to start with PHP! lol

    Mod

    Kenneth John Odle

    #19601

    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 — 🙂

Viewing 10 posts - 1 through 10 (of 26 total)

You must be logged in to reply to this topic.