Exclude first post (sticky or not) from the loop using query_posts()

You shouldn’t really need to “exclude” anything. Just make use of the built in loop tracking. WP_Query will “remember” where you left off. For example: if (have_posts()) { while (have_posts()) { the_post(); echo ‘firstpost##’; the_content(); echo ‘##endfirstpost’; break; } } // do some other stuff if (have_posts()) { while (have_posts()) { the_post(); echo ‘otherposts##’; the_content(); … Read more

Cannot retieve the_content() and the_author() – both returning empty strings

get_the_content and the_author have to be in a loop so you would need to use other functions to get the content you need global $wp_query; $post = $wp_query->post; $page_id = $post->ID; // page ID $page_object = get_page( $page_id ); // page stuff $author_id = $post->post_author; // author ID $page_content = $page_object->post_content; $author_name = get_the_author_meta( ‘display_name’, … Read more

Is wp_reset_postdata() redundant after the main loop?

The first use of wp_reset_postdata() is not redundant its unnecessary. Per the codex Use this function to restore the global $post variable of the main query loop after a secondary query loop using new WP_Query. It restores the $post variable to the current post in the main query. So only use it after your secondary … Read more

Variable not being passed into WordPress loop

If $my_share echoes as “5171,5167,5165” then it is a string not an array… In other words array($string) does not equal array(integer,integer,integer) even if $string equals “integer,integer,integer” because array treats $string as a single value with further values separated by commas. You could use post__in => explode(“,”, $my_share), to convert the string into an array while … Read more