0

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?

  • 1
    Replace 'post_type'=> 'post' with 'post_type'=> 'page'. – nmr Aug 7 '18 at 7:36
3

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',
        ),
    ),
);

Your Answer

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

Not the answer you're looking for? Browse other questions tagged or ask your own question.