Limit the number of characters/words in an excerpt for a related posts section

You can use the get_the_excerpt filter to modify what’s printed by the_excerpt(): add_filter( ‘get_the_excerpt’, ‘wpse_367505_excerpt’ ); function wpse_367505_excerpt( $excerpt ) { return substr( $excerpt, 0, 50 ) . ‘ [Read More]’; } You can change the [Read More] text to whatever you’d like. Add this code to your theme’s functions.php file, and it should automatically … Read more

how to loop through this in blog single?

It appears there is a syntax error with this line: if ( have_posts() ) while ( have_posts() ) : the_post(); You are missing a colon after ( have_posts() ). If it’s not a theme related issue as mentioned in the comments if you change it to: “if ( have_posts() ) : while ( have_posts() ) … Read more

How can I include ALL post types in the_post_navigation() links, not just current post type?

By default the the_post_navigation() uses the current post type, whatever it may be. Luckily, that function eventually calls get_adjacent_post() which has a few hooks we can use. The below uses get_{$adjacent}_post_where where $adjacent is either “previous” or “next”: /** * Modify the posts navigation WHERE clause * to include our acceptable post types * * … Read more

Show single post child category from a determined parent

Well in the end I used custom taxonomy, and it’s also more simple to manage. I post as I did : //hook into the init action and call create_topics_nonhierarchical_taxonomy when it fires add_action( ‘init’, ‘create_regions_nonhierarchical_taxonomy’, 0 ); function create_regions_nonhierarchical_taxonomy() { // Labels part for the GUI $labels = array( ‘name’ => _x( ‘Regions’, ‘Where are … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)