Results 1 to 2 of 2

Thread: Displaying certain custom fields, hiding others

  1. #1
    samh is offline Here For The Peanuts
    Join Date
    Oct 2009
    Location
    London
    Posts
    193

    Default Displaying certain custom fields, hiding others

    Hi all

    I was wondering if it's possible to specify some custom fields (just very basic ones being displayed by 'the_meta()') but to hide others that are being generated automatically. In my case, the disqus comment system.

    What I'm finding (obviously!) is that when I use the_meta(), all custom fields are being displayed. It makes sense, but I unfortunately don't have the know how to only display certain elements.

    This is the first theme I've built from scratch and I'm down to the pesky last 5% which seems to take forever!

    Cheers

    Sam
    Personally: @srhas Professionally: @FootballUtd

  2. #2
    williamsba's Avatar
    williamsba is offline Here For The Peanuts
    Join Date
    Jan 2009
    Location
    New Jersey
    Posts
    181

    Default

    Check out get_post_meta(), used like so:

    Code:
    <?php
    echo get_post_meta( $post_id, 'custom_field_name', true );
    ?>
    Just pass the post ID, custom field name, and whether to return a single value or an array (true/false)

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •