Weird problem on if statement

there is no third parameter for get_field, may be causing your error. EDIT- In your current code, if the 10 most recent posts don’t contain a post with your meta key, you’ll see nothing since you’re only getting 10 posts and then filtering them. Any query that doesn’t specify number of posts defaults to your … Read more

Change content off every sixth element

query_posts should only be used for the main loop. Instead, use a new instance of the WP_Query class: $my_query = new WP_Query( array( ‘post_type’ => ‘post’, ‘posts_per_page’ => 10, ‘order’ => ‘DESC’, ‘paged’=> $paged ) ); echo ‘<ul>’; while ( $my_query->have_posts() ) : $my_query->the_post(); if ( $my_query->current_post > 0 && ( $my_query->current_post + 1 ) … Read more

Displaying links to all posts of the same category on the post page

I’ve not tested this, but the following is the method you shoulduse. Don’t use query_posts. $cats_of_post= get_the_category(); if($cats_of_post){ $cat_id = (int) $cats_of_post[‘0’]->term_id; $related = get_posts(array( ‘numberposts’ => 5, ‘category’ => $cat_id, ‘orderby’ => ‘post_date’, ‘order’ => ‘DESC’, ‘exclude’ => )); global $post; $temp_post = $post;?> <div class=”related-posts”> <?php if( $related ): ?> <ol> <?php foreach … Read more

If Query Post Returns 1 Post

You should not use query_post when you can use the mutch faster query WP_Query. You can count the post with the property post_count. Here is a snippet that counts your post in the loop: <?php $args = array( ‘post_type’ => ‘post’, ‘cat’ => ’20’, ‘post_status’ => ‘publish’, ‘order’ => ‘DESC’ ); // The Query $the_query … Read more

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