• How to get specific post data by using post name & in that post i have create custom fields how to get all data & display i have use below code
    but only post content display

    <?php
    $post_id = 26;
    $queried_post = get_post($post_id);
    $title = $queried_post->post_title;
    echo $title;
    echo $queried_post->post_content;
    ?>

Viewing 1 replies (of 1 total)
  • hello
    To display the Custom Fields for each post, use the the_meta() template tag.

    To fetch meta values use the get_post_meta() function:

    get_post_meta($post_id, $key, $single);

    pls refer this
    -https://codex.www.ads-software.com/Template_Tags/get_posts
    -https://codex.www.ads-software.com/Custom_Fields

Viewing 1 replies (of 1 total)
  • The topic ‘Custom field in post’ is closed to new replies.