How do I render all posts of the same category in same layout?

I believe you are talking about single post pages. The template hierarchy does not make provision for single templates according to the category a post belongs to, so single-{$category}.php does not exist. To make single-{$category}.php work, we can make use of the single_template filter add_filter( ‘single_template’, function ( $template ) { global $post; // Check … Read more

Enabling post thumbnails for custom post type

You are most probably using add_theme_support() in the wrong context (hook). Because you are registering the post type yourself, all you need to do is to add support for thumbnails in the supports array when you pass your your arguments to register_post_type() supports (array/boolean) (optional) An alias for calling add_post_type_support() directly. As of 3.5, boolean … Read more

Search for posts based on their url in the admin?

Here’s one way to support searching for post slugs in the backend. Let’s invoke this kind of search by the slug: string in the search term. Example To search for slugs that end in -2 we want to be able to search for: slug:*-2 where * is the wildcard. Demo Plugin Here’s a demo plugin … Read more

Manually removing revision post types

IF you want, you can disable revisions in first place (No need to run CRON then) To disable them go to wp-config.php and add this line: define(‘WP_POST_REVISIONS’, false ); Or to limit to 10 revisions define(‘WP_POST_REVISIONS’, 10); And to delete all current revisions you can run this SQL query: DELETE FROM wp_posts WHERE post_type = … Read more

Loop on front-page.php

This is how you would do it. You’re loop is based on being in an archive or index page. (or home) $args = array( ‘posts_per_page’ => 3, ‘post_type’ => ‘post’, //choose post type here ‘order’ => ‘DESC’, ); // query $the_query = new WP_Query( $args ); if( $the_query->have_posts() ): while( $the_query->have_posts() ) : $the_query->the_post(); get_template_part(‘loop’); … Read more

Two posts are loaded instead of one?

The core of the problem is that you set cookies when the content is being accessed, not when it is read. Browsers can try to prefetch content, and your description sound like the browser is prefecthing the “next” link found in the header. From experience, you should avoid setting cookies on the server and prefer … Read more