Der Server auf dem die Test-Seite läuft ist nicht von außen erreichbar.
Wenn ich das Plugin aktiviere habe ich kein PHP Error.
Es wird keine Pagination angezeigt weder unter den Posts noch sonst wo auf der Seite.
- habe $query = 1; mal definiert aber es tut sich nichts. Ich weiß auch nicht was die genau bewirken soll.
- $numberposts habe ich entfernt, ändert aber auch nichts.
- Wenn ich pagination links() mit in $content ausgebe gibts nen php error :
syntax error, unexpected '$content' (T_VARIABLE) Keine Ahnung was das heißt....
function itt_artikel(){
//Parameter für Posts
$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;
$query =1;
$args = array(
'category_name' => 'apps, casemods, hardware, raspberry-pi, security, software, windows-10, windows',
'posts_per_page' => 4
);
//Posts holen
$posts = get_posts($args);
//Inhalte sammeln
$content = '<div class="itt-artikel">';
foreach ($posts as $post) {
$content .= '<div class="itt-ein-artikel">';
$content .= '<a href="'.get_permalink($post->ID).'"><div class="itt-hdl-artikel">'.$post->post_title.'</div></a>';
$content .= '<div class="itt-unter-headline"><div class="itt-thumb"><a href="'.get_permalink($post->ID).'"><img src="'.get_the_post_thumbnail_url($post->ID, 'full').'" class="itt-img"></a></div>';
$content .= '<div class="itt-excerpt">'. $post->post_excerpt . '</div></div>';
$content .= '</div>';
}
$content .= '</div>';
$content .= '<div class="pagination">'
$content .= echo paginate_links( array(
'base' => str_replace( 999999999, '%#%', esc_url( get_pagenum_link( 999999999 ) ) ),
'total' => $query->max_num_pages,
'current' => max( 1, get_query_var( 'paged' ) ),
'format' => '?paged=%#%',
'show_all' => false,
'type' => 'plain',
'end_size' => 2,
'mid_size' => 1,
'prev_next' => true,
'prev_text' => sprintf( '<i></i> %1$s', __( 'Newer Posts', 'text-domain' ) ),
'next_text' => sprintf( '%1$s <i></i>', __( 'Older Posts', 'text-domain' ) ),
'add_args' => false,
'add_fragment' => '',
) );
$content .= '</div>';
//Inhalte übergeben
return $content;
}
add_shortcode('itt-artikel-sc', 'itt_artikel');
Alles anzeigen