Custom function making troubles in get_permalink for ACF relationship fields

You shouldn’t rely on the global $post variable for filters like this. In your example you’re passing $event_city->ID to get_the_permalink(). This implies that the $event_city post is not for the same post as the current $post object. This is normal. Sometimes you want to use a function like get_the_title() or get_the_permalink() without changing the global … Read more

Querying & displaying custom post type into an existent page [closed]

You can create a shortcode and add it in any page you want. This code will register your custom shortcode: add_action( ‘init’, ‘register_custom_shortcodes’ ); function register_custom_shortcodes(){ add_shortcode( ‘my-custom-shortcode’, ‘display_movies’ ); } This code will be responsible for the content that will be displayed wherever you place the shortcode: function display_movies(){ ob_start(); //Your code here to … Read more

Recoverable Fatal Error – Object of class WP_Post could not be converted to string

the_title doesn’t work that way: the_title( $before, $after, $echo ); $before is the text that comes before the title, but you didn’t give it a string/text, you gave it a post object. Post objects aren’t strings, PHP doesn’t know what to do so it stops and prints an error instead. For the_title to work, you … Read more

Not displaying posts that are in the past. ACF date > date

You seem to be missing the meta_query proprety and looking at your code you seem to have two meta values mixed, so we need to combine them. $loop = new WP_Query([ ‘category_name’ => ‘gold’, ‘orderby’ => ‘rand’, ‘posts_per_page’ => -1, ‘meta_query’ => [ ‘relation’ => ‘and’, [ ‘key’ => ‘status’, ‘value’ => ‘active’ ], [ … Read more

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