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

Is it possible to change the structure of the HTML generated by the_content()? If yes, how? If not, is there a workaround?

You can use the_content filter, to literally filter the content into your structure. Somthing like this <?php add_filter(‘the_content’,function($the_content){ // find blockquotes $regex = ‘/<blockquote>(.+?)<\/blockquote>([\n|$])/i’; $blockquotes = preg_match_all($regex,$the_content,$matches); // remove blockquotes $main_content = preg_replace($regex,”,$the_content); // rebuild blockqoutes $my_blockquotes=””; foreach ($matches[1] as $blockquote) { $my_blockquotes .= “<blockquote>{$blockquote}</blockquote>”; } // rebuild content $new_content=””; if (!empty($my_blockquotes)) { $new_content = … Read more

Proper way to replace the_content only for pages created by custom plugin

You need to return the filtered content, try like this: add_filter(‘the_content’, ’emd_content’); function emd_content( $content ) { if ( is_page(‘Member Directory’) ) { include dirname( __FILE__ ) . ‘/content-members.php’; } elseif ( is_page(‘Contact Members’) ) { include dirname( __FILE__ ) . ‘/content-member-contact-form.php’; } else { return $content; } } But the better way is to … Read more

Filter only the text in the_content

Based on your comment clarifying what you want to achieve, it appears you want to display the first 60 characters of your post not including any shortcodes. To do this you can use the strip_shortcodes() function. Rewritten with that, your code will look like this: $content = strip_shortcodes(get_the_content()); $content = apply_filters(‘the_content’, substr($content, 0, 60) ); … Read more

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