Hi there,
Thank you for getting in touch with us.
In order to change blog feed layout you need to customize theme files in Child Theme.
To change excerpt please add the following code to functions.php in Child Theme:
function kale_excerpt_more($more) {
global $post;
return '<a href="'. get_permalink($post->ID) . '"> ' . __( 'Read more', 'kale' ) . '</a>';
}
add_filter('excerpt_more', 'kale_excerpt_more');
Hope that helps. Thank you for your time in this.
Best regards
I feel silly for asking, but is this possible to do on a wordpress.com site hosted on Bluehost? My site runs the Kale theme, but it’s not through ww.wp.xz.cn.
No worries, @moneysloths! If your site is running on Bluehost, then it runs the WordPress version from ww.wp.xz.cn.
Is a style.css sheet required in a Child Theme? Or can I just create a functions.php in a Child Theme and put in the code that @jarektheme provided?
If you do not want style changes, you do not necessarily need rules in the style sheet. But a style.css file is required in the child theme because it contains the name and the declaration that it is a child theme of the specific parent theme.
Hi Lyrathemes/Jarektheme,
I’m having some trouble with the Child theme set up. When I activate the child theme, the “Read More” option works, but the theme of the kale theme gets messed up.
I created this style.css in my file manager:
/*
Theme Name: Kale Child
Theme URI: http://example.com/kale-child/
Description: Kale Child Theme
Author: John Doe
Author URI: http://example.com
Template: kale
Version: 1.0.0
License: GNU General Public License v2 or later
License URI: http://www.gnu.org/licenses/gpl-2.0.html
Tags: light, dark, two-columns, right-sidebar, responsive-layout, accessibility-ready
Text Domain: kale-child
*/
Separately, I created this functions.php file:
<?php
function my_theme_enqueue_styles() {
$parent_style = 'kale-style'; // This is 'kale-style' for the Kale theme.
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style ),
wp_get_theme()->get('Version')
);
}
function kale_excerpt_more($more) {
global $post;
return '<a>ID) . '"> ' . __( 'Read more', 'kale' ) . '</a>';
}
add_filter('excerpt_more', 'kale_excerpt_more');
add_action( 'wp_enqueue_scripts', 'my_theme_enqueue_styles' );
?>
Also, is it easy to have the excerpt be longer? In other words, can I extend the length of the excerpt in front of “read more”?
-
This reply was modified 8 years, 11 months ago by
moneysloths.
Hi @moneysloths,
Please modify your functions.php file to include also the couple of required styles:
function my_theme_enqueue_styles() {
wp_register_style('bootstrap', get_template_directory_uri() . '/assets/css/bootstrap.min.css' );
wp_register_style('bootstrap-select', get_template_directory_uri() . '/assets/css/bootstrap-select.min.css' );
wp_register_style('font-awesome', get_template_directory_uri().'/assets/css/font-awesome.min.css' );
wp_register_style('owl-carousel', get_template_directory_uri().'/assets/css/owl.carousel.css' );
$deps = array('bootstrap', 'bootstrap-select', 'font-awesome', 'owl-carousel');
wp_enqueue_style( 'parent-style', get_template_directory_uri().'/style.css', $deps );
}
To change excerpt length add this functions to your Child Theme:
function kale_excerpt_length( $length ) {
return 60;
}
add_filter( 'excerpt_length', 'kale_excerpt_length', 999 );
Hope that helps.