get_post() is not returning correct value

That’s not how you update posts. Because you used raw SQL to do it, none of the filters or actions fired, and none of WP_Cache was updated, so it’ll return an old version of the post it fetched earlier when you call get_post. Instead, if you want to update a post, use wp_insert_post and pass … Read more

Get post format and use it as a CSS class in different spans

Every post has a maximum of one format and one status. To echo the format you need: if (get_post_format($post->ID)) echo ‘<span class=”format-‘ . get_post_format($post->ID); . ‘”></span>’; To echo the status you need this: if (get_post_status($post->ID)) echo ‘<span class=”status-‘ . get_post_status($post->ID); . ‘”></span>’; Hopefully this is what you need.

Loading post template that contains a nested loop with ajax

Your inner loop overwrites the contents of $post, so any later template tags use the values of whatever it last contained. “But I used wp_reset_postdata()!” you say? What that function does is try to restore $post from $wp_query->post. It’s meant to restore the main query after secondary queries. You have two secondary queries here, so … Read more

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