Created
August 15, 2014 21:30
-
-
Save nathanaelphilip/f5f327f7f77b6543f47b to your computer and use it in GitHub Desktop.
This file contains 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
global $wp_query; | |
$news = new wp_query(array('post_type' => 'news','nopaging' => true)); | |
$psts = $wp_query->posts; | |
$nws = $news->posts; | |
$pstsnumber = count($psts); | |
$newsnumber = count($nws); | |
$break = $pstsnumber/$newsnumber; | |
$current = 0; | |
$nwskey = 0; | |
echo $nwskey; | |
echo $newsnumber; | |
foreach ($psts as $key => $p) { | |
#echo $current; | |
if ( ($break == $current) && ($nwskey < $newsnumber) ) { | |
echo $key."<br>"; | |
#$psts[] = $nws[$nwskey]; | |
$current = 0; | |
} | |
#$psts[] = $p; | |
$nwskey++; | |
$current++; | |
} | |
#print_r($psts); | |
$wp_query->found_posts = $wp_query->found_posts + $pstsnumber; | |
$wp_query->posts = $psts; | |
#$wp_query = $news; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment