WordPress.org

Forums

Genesis Translations
[resolved] Changing Excerpt Read More link (4 posts)

  1. lucaslem
    Member
    Posted 1 year ago #

    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/

  2. Remkus de Vries
    Member
    Plugin Author

    Posted 1 year ago #

    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.

  3. pelchatd62
    Member
    Posted 1 year ago #

    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>';
    }
  4. Remkus de Vries
    Member
    Plugin Author

    Posted 1 year ago #

    Glad you've got it working.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Genesis Translations
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic

Tags

No tags yet.