Frage

I am using this code to pass arguments in posts:

$args_automobile_just_launched_bike = array(
    'posts_per_page' => 3,
    'post_type'      => 'post',
    'order'          => 'DESC',
    'meta_query'     => array(
        array(
            'key'   => 'wpcf-new-launch-bikes',
            'value' => '1',
        ),
    ),
);

This is the format of getting posts dynamically.
How can I do the same for Page?

War es hilfreich?

Lösung

Pages are posts, you just need to change the post_type to page:

$args_automobile_just_launched_bike = array(
    'posts_per_page' => 3,
    'post_type'      => 'page',
    'order'          => 'DESC',
    'meta_query'     => array(
        array(
            'key'   => 'wpcf-new-launch-bikes',
            'value' => '1',
        ),
    ),
);
Lizenziert unter: CC-BY-SA mit Zuschreibung
Nicht verbunden mit wordpress.stackexchange
scroll top