WordPress.org

Ready to get started?Download WordPress

Forums

Spun
[resolved] How to remove [...] and add read more instead? (10 posts)

  1. Xeniya
    Member
    Posted 3 months ago #

    Hello everyone,

    I added several posts on my News page and mentioned that my articles do not appear fully and breaks with this sign [...]. When I click on the title, the new page loads with the full article.

    I don't mind this but I would like to remove [...] and create a clickable "Read more". The button "Read more" in the text editor doesn't work.

    Here is the screenshot of the page: http://snag.gy/pb6We.jpg
    And the link of the page itself: http://www.girlsxchlamydia.nl/about/news/

    Thank you!

    Best regards,
    Xeniya

  2. salsaturation
    Member
    Posted 3 months ago #

    Hi Xeniya

    I was hoping that you were using a child_theme but it doesn't look like you are.

    Try adding the following code to functions.php (I would suggest via ftp rather than the admin editor)

    // Replaces the excerpt "more" text by a link
    function new_excerpt_more($more) {
           global $post;
    	return '<a class="moretag" href="'. get_permalink($post->ID) . '"> Read more</a>';
    }
    add_filter('excerpt_more', 'new_excerpt_more');
  3. Xeniya
    Member
    Posted 3 months ago #

    @salsaturation

    I have a Child Theme.

    Thanks for the solution but when I add the code that you posted to functions.php I get this http://snag.gy/HAegF.jpg above my page. Also, the [...] is still there.

    Is there anything else I can do?

  4. salsaturation
    Member
    Posted 3 months ago #

    strange - let me install the theme and try it out

  5. Xeniya
    Member
    Posted 3 months ago #

    This is what I have in my functions.php now:

    <?php
    
    function textInCircles() {
            wp_enqueue_script( 'text-in-circles', get_stylesheet_directory_uri() . '/js/text-in-circles.js', '', '1.0', true );
    }
    
    add_action( 'wp_enqueue_scripts', 'textInCircles' );
    
    ?>
  6. salsaturation
    Member
    Posted 3 months ago #

    can you paste your you functions.php including the code I posted above

  7. Xeniya
    Member
    Posted 3 months ago #

    Like that? It doesn't matter if I paste your code before or after mine. It still appear at the top of the page

    <?php
    
    function textInCircles() {
            wp_enqueue_script( 'text-in-circles', get_stylesheet_directory_uri() . '/js/text-in-circles.js', '', '1.0', true );
    }
    
    add_action( 'wp_enqueue_scripts', 'textInCircles' );
    
    ?>
    
    // Replaces the excerpt "more" text by a link
    function new_excerpt_more($more) {
           global $post;
    	return '<a class="moretag" href="'. get_permalink($post->ID) . '"> Read more</a>';
    }
    add_filter('excerpt_more', 'new_excerpt_more');
  8. salsaturation
    Member
    Posted 3 months ago #

    please note that code needs to be enclosed inside php tags like this

    <?php
    all code goes here
    ?>

    Anyway try this...

    <?php
    
    function textInCircles() {
            wp_enqueue_script( 'text-in-circles', get_stylesheet_directory_uri() . '/js/text-in-circles.js', '', '1.0', true );
    }
    
    add_action( 'wp_enqueue_scripts', 'textInCircles' );
    
    // Replaces the excerpt "more" text by a link
    function new_excerpt_more($more) {
           global $post;
    	return '<a class="moretag" href="'. get_permalink($post->ID) . '"> Read more</a>';
    }
    add_filter('excerpt_more', 'new_excerpt_more');
    
    ?>
  9. Xeniya
    Member
    Posted 3 months ago #

    Oh, I made such a stupid mistake.

    Thank you!

    Have a nice day\night!

  10. salsaturation
    Member
    Posted 3 months ago #

    no worries - you too

Reply

You must log in to post.

About this Theme

About this Topic

Tags

No tags yet.