WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Changing Excerpt Read More link

[Resolved] Changing Excerpt Read More link

  • lucaslem

    @lucaslem

    Hello,

    I am using your plugin with great success on a multisite install (main site = eng, sub-site = french). I have created a custom child theme based on genesis framework.

    I have changed the “read more” for excerpts and while it works in english, I cannot get it to display in french. Here is my code. Any advice would be welcome. Thanks!

    //* Changing excerpt more - display where "read more tag" is used.
    add_filter('excerpt_more', 'auto_excerpt_more');
    function auto_excerpt_more($more) {
        if ( 'fr_FR' == $language ) {
            return '… <a href="'.get_permalink().'" rel="nofollow">Lire</a>';
        }
        else {
            return '… <a href="'.get_permalink().'" rel="nofollow">Read</a>';
        }
    }

    http://wordpress.org/plugins/genesis-translations/

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Author Remkus de Vries

    @defries

    Sorry, I missed a notification for this support question. In this case the variable $language is not loaded and thus it can not make a comparison properly.

    I used that piece of code. I don’t remember where I found some part of it and changed other parts.

    function custom_excerpt($text) {  // custom 'read more' link
       if (strpos($text, 'Lire plus&nbsp;&raquo;')) {
          $excerpt = str_replace('<p>', '', $text);
       } else {
          $excerpt = substr($text, 0, strrpos($text, '</p>')) . '<a href="'.get_permalink().'">Lire plus&nbsp;&raquo;</a></p>';
       }
       return $excerpt;
    }
    add_filter('the_excerpt', 'custom_excerpt');
    
    function new_excerpt_more($more) {
      global $post;
      return '… <a href="'. get_permalink($post->ID) . '">' . 'Lire plus&nbsp;&raquo;' . '</a>';
    }
    Plugin Author Remkus de Vries

    @defries

    Glad you’ve got it working.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘[Resolved] Changing Excerpt Read More link’ is closed to new replies.