the_content not working on one of two Multisite sites

Check for any filters that only return if certain conditions are met. I had an issue once where almost all my pages’ content areas were blank. I found the problem was in a snippet of code that looked like this: add_filter( ‘the_content’, ‘this_will_blank_pages’ ); function this_will_blank_pages( $content ) { if( is_page( ‘some-page-title’ ) ) { … Read more

If is_single in functions.php

Generally it’s not a common way to strip wpautop with remove_filter as it is native functionality of WordPress. But if you want to : place the remove_filter() function right before the the_content() function on the pages/templates where you don’t need the wpautop <?php remove_filter( ‘the_content’, ‘wpautop’ ); the_content();?>

Get Content Limit?

Limiting the content to a number of words is a little tricky. Limiting the number of characters is much easier to do and is built in to WordPress already. You can use the the_excerpt() and get_the_excerpt() functions to limit the number of characters in the beginning of the post content. The example in the first … Read more

alternative to the_content filter

In functions.php: function myExcerpt($text) { $text = str_replace(‘]]>’, ‘]]&gt;’, $text); $text = strip_tags($text); $excerpt_length = 50; // max number of words $words = explode(‘ ‘, $text, $excerpt_length + 1); array_pop($words); array_push($words, ‘-N’); $text = implode(‘ ‘, $words); return $text; } In your loops: echo myExcerpt ( get_the_content() );

content and excerpt not displaying

I figured it out myself and it worked. Here is the code if anyone need any help. $the_query = new WP_Query(‘page_id=1’) ; if ( $the_query->have_posts() ) { while ( $the_query->have_posts() ) { $the_query->the_post(); the_title(); the_content(); the_excerpt(); } } else { // no posts found } wp_reset_postdata(); Edit: This is working because the_content() and the_excerpt() have … Read more

Sort appearence order in the_content()

You could try to add the Facebook-Like html code via this filter: /** * Append Facebook Like to the content * * @param string $content * @return string $content */ function custom_the_content( $content ) { $fblike=”<div class=”fb-like” data-layout=”button_count” data-action=”like” data-show-faces=”false” data-share=”false”> </div>”; return $content . $fblike; } add_filter( ‘the_content’, ‘custom_the_content’, 9, 1 ); if the … Read more

IF Inside A Function For Content Filter [closed]

This should be it – <?php function my_the_content_filter( $content ) { if( get_post_meta( get_the_ID(), “heading_image”, true) ) { $image_id = get_post_meta( get_the_ID(), “heading_image”, true); $post_image_data = wp_get_attachment_image_src( $image_id, ‘full’ ); ?> // checks if you have got the source if( isset($post_image_data[0]) ) { // if image is show before the content $content=”<img src=””. $post_image_data[0] .'” … Read more

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