How can I get the homepage from the loop?

That depends on what your trying to do. If you want to get the page content in another template or functions file and your home page is a page that you created in the dashboard and set as the static front page you can use get_page_by_path function like this: get_page_by_path(‘the_path_of_the_page’); // Usually will be ‘home’ … Read more

How to update all posts but the current one (post__not_in not working?)

There’s a more elegant way of updating your posts using the global $wpdb. function rsc_unpublish_all_ads( $post_id, $post, $update ) { // select all ads other than the current one $args = array( ‘nopaging’ => true, ‘post__not_in’ => array($post_id), ‘post_type’ => ‘rsc-ads’, ‘post_status’ => ‘publish’, ‘fields’=>’ids’ ); $query = new WP_Query($args); $published_ads = $query->posts;//array of post … Read more

How to filter get_post with ACF by a checkbox field?

So, the scattered documentation on this is really less than clear. For checking for unchecked posts added the following meta_query: ‘meta_query’ => array(array( ‘key’ => ‘external’, ‘value’ => ‘0’, ‘compare’ => ‘=’ )) For filtering by checked it was just this: meta_query => array(array( ‘key’ => ‘external’, ‘value’ => ‘0’, ‘compare’ => ‘=’ ))

Insert Content In Between Post Feed

I’ve found old pieces of code and joined it with yours. It could be more elegant, but you have the idea. <?php $args = array( ‘category__not_in’ => array( 20 ), ); $query = new WP_Query( $args ); $posts = $query->posts; wp_reset_postdata(); $post_counter = 1; // secondary posts’ categories (ids) $sec_categories = [2, 14, 56, 234]; … Read more

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