How can I display “read more” without any other post text?

You can achieve this with many ways. First thing you need to use the_excerpt() instead of the_content() and in your functions.php file you can add this function to return 0 text from post text. function custom_excerpt_length($length) { if (is_home()) { return 0; } } add_filter(‘excerpt_length’, ‘custom_excerpt_length’); This code check if this is homepage you can … Read more

Problem on the_excerpt(); function

Assuming that you want the full post content to appear only on single blog posts, and that you want the post excerpt to appear everywhere else, try something like this inside your Loop in index.php: <?php if ( is_singular() ) { the_content( ‘Read More’ ); } else { the_excerpt(); } ?> Additional Codex reading: the_content() … Read more

limit how many words show up in the_content on index

Try wp_trim_words() https://codex.wordpress.org/Function_Reference/wp_trim_words You won’t be able to use it with the_content() though because it echoes the content. You’ll want to use it with get_the_content() which just returns the info. So it’d look something like this echo wp_trim_words( get_the_content(), $num_words, $more_text ); Edit: It’s good to note that the_content and get_the_content will return/echo any HTML … Read more

Appending code to the_content

You are looking to filter the_content. In your theme’s functions.php or in a plugin: function wpse74288_content_filter( $content ) { /* save field into variable, such as to call get_field only once * not required, but more efficient */ $who_specialises = get_field(‘who_specialises’); /* append to content on condition */ if ( in_array( ‘frazer-barton’, $who_specialises ) ) … Read more

Hook midway through the_content();?

Use this function ad_content() in replace of the_content() in your template. function ad_content() { $content = apply_filters ( ‘the_content’, get_the_content () ); $content = explode ( “</p>”, $content ); $half_way = ( count($content) / 2); for ( $i = 0; $i < count( $content ); $i ++ ) { if ( $i == $half_way ) … Read more

embed the_content

So I’ve never really found out why oembed urls added via apply_filters(‘the_content’, $output), are not processed while embed shortcodes are. Im still hopeful someone might shed some light on that. I really wanted to use Alex King’s post type formats UI which is why I didn’t follow David’s example. I ended up detecting the input … Read more