Aufgrund einer komplexen Multisite-Konfiguration habe ich eine Abfrage, die die Beiträge von zwei Blogs kombiniert, und ich möchte die Ergebnisse paginieren . Ich bin für jede Hilfe dankbar. Ich habe meine Anfrage gepostet.
$latestposts = $wpdb->get_results(
"
(SELECT * FROM net_5_posts
INNER JOIN net_5_term_relationships ON net_5_posts.ID=net_5_term_relationships.object_id
WHERE post_type = 'post'
AND post_status = 'publish'
AND term_taxonomy_id = '151'
)
UNION ALL
(SELECT * FROM net_7_posts
INNER JOIN net_7_term_relationships ON net_7_posts.ID=net_7_term_relationships.object_id
WHERE post_type = 'post'
AND post_status = 'publish'
AND term_taxonomy_id = '20'
)
ORDER BY post_date
DESC LIMIT 5",'ARRAY_A');
foreach ($latestposts as $latestpost) {
$da_id = $latestpost['ID'];
$da_title = $latestpost['post_title'];
$da_content = strip_tags($latestpost['post_content']);
$da_content = limit_words($da_content,55);
$da_link = $latestpost['guid'];
$da_date = $latestpost['post_date'];
$da_date = date('F j, Y', strtotime($da_date));
echo '
<div class="ldapost">
<h2 class="lheader"><a href="'.$da_link.'">'.$da_title.'</a></h2>
<span class="ldate">'.$da_date.'</span>
<span class="lcontent">'.$da_content.'…</span><br>
<a class="button btnright" href="'.$da_link.'">Continue Reading</a>
</div>
';
}
customization
pagination
query
wpdb
uknowit2
quelle
quelle
quelle