Created
November 22, 2014 11:00
-
-
Save ibrokemywp/c106d7b7e890d4180a13 to your computer and use it in GitHub Desktop.
Reset the loop after you've hijacked it
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Go ahead. Do your fancy shit | |
*/ | |
$your_query = new WP_query( 'post_type' => 'your_cool_post_type' ); | |
while( $your_query->have_posts() ) { | |
$your_query->the_post(); | |
/** | |
* Look at your cool template function. | |
* That looks just like my template function. | |
* Oh, that's because it is. Now my page's | |
* the_title() is your post's the_title(). | |
*/ | |
the_title(); | |
} | |
/** | |
* You can give me back my the_title() like this. | |
*/ | |
wp_reset_query(); | |
/** | |
* Thanks dude. | |
*/ |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment