0

I created my own template for a CPT. A loop with the content of a certain post type is to be shown here. Except for a couple of "little things", it actually works.

However, there are a couple of errors that I have noticed that I cannot fix on my own. 1.) If I publish a normal post, it will also be shown in this listing, although a completely different Post_Type is actually being addressed here 2.) The posts_per_page does not work ... If I enter "10", for example, more will definitely be displayed here.

<?php 

$paged = ( get_query_var( 'paged' ) ) ? get_query_var( 'paged' ) : 1;



// WP_Query arguments
$args = array (
    'post_type'         => '3d_drucker' ,
    'post_status'       => array( 'publish' ),
    'nopaging'               => false,
    'paged' => $paged, 
    'posts_per_page' => '10',
    'meta_query' => array(
        array(
            'key' => 'typ',
            'value' => 'Extrusion 3D-Drucker'
        ),
    )   
);
query_posts($args);

// The Query

$query = new WP_Query( $args );

// The Loop
if ( $query->have_posts() ) { ?>

Do you need all the code? Then I'll make it available! Homepage: https://dein-3d.com/3d_drucker/liste/

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.