Pulling posts tagged with similar title name

First of all, don’t use query_posts Form Codex: Note: This function isn’t meant to be used by plugins or themes. As explained later, there are better, more performant options to alter the main query. query_posts() is overly simplistic and problematic way to modify main query of a page by replacing it with new instance of … Read more

Using $seed on a custom post type for randomly displayed posts

This is untested, but I think it should work. Add the filter in pre_get_posts if it’s your post type archive, otherwise remove it for any queries that follow the post type archive main query. function wpd_add_posts_orderby( $query ){ if( $query->is_post_type_archive(‘your-cpt’) ){ add_filter(‘posts_orderby’, ‘edit_posts_orderby’); } else { remove_filter(‘posts_orderby’, ‘edit_posts_orderby’); } } add_action( ‘pre_get_posts’, ‘wpd_add_posts_orderby’ );

Show all posts of all categories but excluding a category on custom blog page with pagination of my theme

If you take a look at the category parameters of WP_Query, you’ll see that you can use either cat=-12 or category__not_in’ => 12 to exclude a category with ID 12 in your custom query. I just also want to point out a few things here. showposts is depreciated, you should be using posts_per_page. Also ‘showposts=6’ … Read more

Automatically create a loop for post ID

“The Loop” is already a loop, so I don’t see the need for your second loop. In fact, the secondary while loop shouldn’t work because you keep resetting it to 1 for every post. You also have some PHP syntax issues like $echo (that’s a variable) instead of echo and the way you concatenate the … Read more

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