• pukkascott

    (@pukkascott)


    I am using the <!–more–> html in my posts to reduce the post when shown in a list and the link text shown is the standard “Continue Reading…” I want to change this to “MORE STORIES FROM THIS DAY…

    Is there a way to do this on all existing blogs in the Highwind code instead of entering it manually on each post? I have seen ways on other themes but not on Highwind.

    Thanks for your help

Viewing 5 replies - 1 through 5 (of 5 total)
  • gtsiokos

    (@gtsiokos)

    Hi pukkascott.
    The solution is here
    or simply use this

    add_filter( 'the_content_more_link', 'modify_read_more_link' );
    function modify_read_more_link() {
    return '<a class="more-link" href="' . get_permalink() . '">Your Read More Link Text</a>';
    }

    WPyogi

    (@wpyogi)

    Do make sure that any code modifications are made in a child theme so that they are not lost when the theme is updated.

    https://codex.www.ads-software.com/Child_Themes

    Thread Starter pukkascott

    (@pukkascott)

    Hi guys, thanks for the replies. I am a bit of a beginner with code but know my way around WordPress. I have a Highwind Child theme that has a functions.php which I used to get my posts to appear in ascending order. I have to admit that while doing that I mucked up my whole site so I am playing safe with this. Can you gently tell me where to place the suggested additional code within the existing code shown here:

    <?php
    // Exit if accessed directly
    if ( !defined('ABSPATH')) exit;
    
    // BEGIN ENQUEUE PARENT ACTION
    
    if (!function_exists('chld_thm_cfg_parent_css')):
        function chld_thm_cfg_parent_css() {
            wp_enqueue_style('chld_thm_cfg_parent', get_template_directory_uri() . '/style.css');
        }
    endif;
    add_action('wp_enqueue_scripts', 'chld_thm_cfg_parent_css');
    
    // END ENQUEUE PARENT ACTION
    
    // Runs before the posts are fetched
    add_filter( 'pre_get_posts' , 'my_change_order' );
    // Function accepting current query
    function my_change_order( $query ) {
    	// Check if the query is for an archive
    	if($query->is_archive)
    		// Query was for archive, then set order
    		$query->set( 'order' , 'asc' );
    	// Return the query (else there's no more query, oops!)
    	return $query;
    }
    ?>

    Many thanks

    Scott

    gtsiokos

    (@gtsiokos)

    You should put it after the closing } and before the closing ?>

    Thread Starter pukkascott

    (@pukkascott)

    Many thanks, it works perfectly and as a bonus I didn’t destroy my site! Great solution.

    For the record my Child theme functions.php is now:

    <?php
    // Exit if accessed directly
    if ( !defined('ABSPATH')) exit;
    
    // BEGIN ENQUEUE PARENT ACTION
    
    if (!function_exists('chld_thm_cfg_parent_css')):
        function chld_thm_cfg_parent_css() {
            wp_enqueue_style('chld_thm_cfg_parent', get_template_directory_uri() . '/style.css');
        }
    endif;
    add_action('wp_enqueue_scripts', 'chld_thm_cfg_parent_css');
    
    // END ENQUEUE PARENT ACTION
    
    // Runs before the posts are fetched
    add_filter( 'pre_get_posts' , 'my_change_order' );
    // Function accepting current query
    function my_change_order( $query ) {
    	// Check if the query is for an archive
    	if($query->is_archive)
    		// Query was for archive, then set order
    		$query->set( 'order' , 'asc' );
    	// Return the query (else there's no more query, oops!)
    	return $query;
    }
    add_filter( 'the_content_more_link', 'modify_read_more_link' );
    function modify_read_more_link() {
    return '<a class="more-link" href="' . get_permalink() . '">MORE STORIES FROM THIS DAY... </a>';
    }
    ?>
Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘Changing the "Continue reading…" text in Highwind’ is closed to new replies.