WordPress.org

Forums

Alkane
Customize the Read More (3 posts)

  1. kumrae
    Member
    Posted 1 year ago #

    Is it possible to customize the Read More after the post excerpt on the home page? I am new to WordPress and tried to edit <?php the_content() to include the text 'Continue reading' in both the content-page.php and content-single.php and did not work. Also, I want to change the text color when you hover over Read More. Maybe I am looking in the wrong place?

  2. kaniamea
    Member
    Posted 1 year ago #

    Hello,
    you can change that in the functions.php file. First create a child theme of Alkane and then create a functions.php file with the following:

    add_filter( 'the_content_more_link', 'alkane_content_more_link', 10, 2 );
    function alkane_content_more_link( $more_link, $more_link_text ) {
    	return str_replace( $more_link_text, '<span>'. __( 'Continue reading &rarr;', 'alkane' ) .'</span>', $more_link );
    }
  3. kumrae
    Member
    Posted 1 year ago #

    Hi there,

    Thanks for the help but unfortunately didn't work. I did create a child theme and activated it - everything looked normal.

    Then I created a functions.php file with the code you provided above, but when I loaded it into the child folder in FTP (same path as the original functions.php for the parent folder) it caused everything to be blank page including my wordpress account.

    For reference, this is what is in the original alkane functions.php file:

    <?php

    /** Load the Core Files */
    require_once( trailingslashit( get_template_directory() ) . 'lib/init.php' );
    new Alkane();

    /** Do theme setup on the 'after_setup_theme' hook. */
    add_action( 'after_setup_theme', 'alkane_theme_setup' );

    /** Theme setup function. */
    function alkane_theme_setup() {

    /** Add theme support for Feed Links. */
    add_theme_support( 'automatic-feed-links' );

    /** Add theme support for Custom Background. */
    add_theme_support( 'custom-background', array( 'default-color' => 'fff' ) );

    /** Set content width. */
    alkane_set_content_width( 640 );

    /** Add custom image sizes. */
    add_action( 'init', 'alkane_add_image_sizes' );

    }

    /** Adds custom image sizes */
    function alkane_add_image_sizes() {
    add_image_size( 'featured', 200, 200, true );
    }

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic