How to show part of the_content?

Check out the WordPress Codex reference page for the_excerpt() as it is a built-in way of doing what you’re looking to accomplish: http://codex.wordpress.org/Function_Reference/the_excerpt EDIT: it also has an example for shortening the excerpt beyond the default length.

Display post category in foreach loop with category link

You are fighting with the post globals, like $post, and are not getting them set correctly. Create a proper Loop using WP_Query and use Core template tags where possible and the problem will go away. $authors_posts = new WP_Query( array( ‘author’ => 7, ‘posts_per_page’ => 6, ‘post__not_in’ => array( $post->ID ) ) ); $output=”<ul>”; while … Read more

Adding specific post category between posts in loop

You can use this as a start. This need to go into functions.php. You can use your normal loop in your template files, no need to change anything there. This will add a post from a category after post 3 and 6. Just remember to change the category name with the slug of your category. … Read more

Display featured products by category

First, you have to determine from what category you want to display those products. If this happends on a single post display, you can get all post’s categories via wp_get_object_terms function global $post; $query_args[ ‘category__in’ ] = wp_get_object_terms( $post->ID, ‘category’, array( ‘fields’ => ‘ids’ ) ); If this happens on a archive page, you can … Read more

How to change permalink on post click on post listing page

you need to using jquery function functionality <script> var current_main = window.location.pathname; var current= document.URL; //var lastElement = current.substr(current.lastIndexOf(“https://wordpress.stackexchange.com/”) + 1); var main_url = currentq+”?”+thechosenone+”=”+thechosenone; var main = history.pushState(current,””, main_url ); </script> by using this you can able to append the url’s with specified get methods. I hope this will help you

Make Post Editor Select Number of Columns To 1 By Default

Ok, so this is how I did it. This hook into the admin head, find the screen options part and set the default checked radio button to 1, which mean full screen. Just found the answer from here and give it a little modification: add_action( ‘admin_head’, ‘wpse1152474_post_editor_columns’); function wpse1152474_post_editor_columns() { global $pagenow, $typenow; if ($pagenow … Read more

Cron job not firing

It seems you are using your regular cron for that and it seems you are using the WP cron incorrectly in your example above. If you want to use wp cron in anything, this is the basic usage: if ( ! wp_next_scheduled( ‘wpcron_hook’ ) ) { wp_schedule_event( time(), ‘hourly’, ‘wpcron_hook’ ); } add_action( ‘wpcron_hook’, ‘delay_myposts’ … Read more