Trim Post Content on Home Page

On your theme folder, open the index.php (or, home.php, or, front-page.php), and find, if there is a function named: the_content() Just change it to: the_excerpt() P.S.: If you can’t find the_content() in the mentioned file, try searching content.php, and in this case, change it with caution. Because in theme TwentyTwelve, it’s used with conditional tags … Read more

Post is in descendant category not working in home.php

home.php is an archive of posts, and when you view home.php and function in plugin run, (on ‘wp’ hook) there is no current post. So the function post_is_in_descendant_category call in_category($descendants, null) that can never return true if there is no current post. For this reason, you should run the plugin function on ‘the_post’ action hook, … Read more

Contributors should only access home page

Yes this is possible. You can use the login_redirect filter to do this. Use the code below in your active theme’s functions.php file. function my_login_redirect( $redirect_to, $request, $user ) { //is there a user to check? global $user; if( isset( $user->roles ) && is_array( $user->roles ) ) { //check for contributors if( in_array( “contributor”, $user->roles … Read more

get_the_post_thumbnail($post->ID, ‘thumbnail’); not working. How can I solve this?

The problem of showing the thumbnail twice is because of your the_content(); which is defined in the content-page.php file that has the line the_post_thumbnail(); that will get the featured image. so intead of using the the_content() just use the get_the_content() function to get only the content without the featured image. Let me know if that … Read more

Shows only one Category in home page

Use pre_get_posts to modify the query before it is executed: function include_category( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( ‘cat’, ’17’ ); } } add_action( ‘pre_get_posts’, ‘include_category’ );

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