Access the wp_query of the loop with the global $the_lp_query

The query of every loop can be accessed via the global $the_lp_query.
The global $the_lp_query holds the active wp_query object.
If you print_r( $the_lp_query ) in a function you hook to the loop. You will get something like this:
WP_Query Object (     [query_vars] => Array         (             [error] =>              [m] =>              [p] => 0             [post_parent] =>              [subpost] =>              [subpost_id] =>              [attachment] =>              [attachment_id] => 0             [name] =>              [static] =>              [pagename] =>              [page_id] => 0             [second] =>              [minute] =>  ...
If you want to find out the current_post number you can use the global $the_lp_query.
In this example the current_post number is displayed before the loop item
add_action('tk_loop_designer_before_loop_item', 'every_x_entry');
function every_x_entry(){
    global $the_lp_query;
    echo $the_lp_query->current_post;

Still need help? Contact Us Contact Us