Adding Author Filter to CPTs

This isn’t a WordPress problem, it’s a programming logic mistake in this if statement: if( ‘booking’ || ‘ticket’ !== $post_type ) { This code is the same as this: if( ( ‘booking’ != false ) || ( ‘ticket’ !== $post_type ) ) { Which in plain language is: If “booking” is a truthy value, or … Read more

Display two previous posts on single.php

I hope there are multiple ways to accomplish this, but I suggest you use the following simpler function for this purpose. This is an attempt to grab a post for the current post which excludes it and the previous post: // A custom function in your functions.php file function get_related_previous_post($previous = 0) { global $post; … Read more

Update shortcode values using ajax call

The problem here is how PHP works. Once the server is done processing the GET request for a page, everything related to that request (i.e. values stored in global variables) is cleared and are lost. What you need to is to keep track of, one way or the other, the month index in the front … Read more

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