Query Number of Loaded Posts in Loop

The literal implementation would be to: Create array variable While looping add to it ID of each post, using term name as key (so you have array of arrays) After main loop check the array and query additional posts if needed, using stored IDs for post__not_in so there are no duplicates Syntax will be something … Read more

Change taxonomy of posts

If you are not sure how your site will behave when upgrading or changing themes, you should create yourself a test/dev site. There are many tutorials out there that can help you set up a local test site. You can make a copy of your live site and transfer that all to your test site … Read more

Display the first tag assigned to a post

Assign taxonomy terms (ie tags) to a post in a specific order has no sense form me unless the taxonomy is hierarchical. The core tags taxonomy is no-hierarchical and category is hierarchical. So, you can define a hierarchical custom taxonomy or use the built-in category taxonomy. Think in a natural flow of description terms. In … Read more

rewriting for custom taxonomy rewrite

All you need is pass the URL structure in the arguments when registering your custom taxonomy. For example: add_action( ‘init’, ‘register_my_taxonomy’ ); function register_my_taxonomy() { $args = array( //Complete the arguments for your taxonomy // The rewrite argument should looks like this ‘rewrite’ = array( “slug” => “cars/my-tax” ) ); register_taxonomy( ‘my-tax’, ‘my-post-type’, $args ); … Read more

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