Question

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?

Was it helpful?

Solution

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',
        ),
    ),
);
Licensed under: CC-BY-SA with attribution
Not affiliated with wordpress.stackexchange
scroll top