After reading and trying just about anything I can find,

After reading and trying just about anything I can find, I need to wave the white flag. I am running multisite and have created a custom post type with custompress with 10 custom fields. I simply want to display the value of one of the custom fields for one post on a page in one of the sites. I don’t know PHP at all and would rather not use it, but I cannot seem to find the shortcode that will pull only the value of the custom field. If PHP is the only way to do it. How do I get wordpres to recognize PHP. Sorry for the ignorance, but I hope someone can help

  • Patrick
    • Support Monkey

    Hi @ann

    Welcome to the forums!

    Under the Shortcodes tab in CustomPress, scroll down to the bottom where you’ll see the Custom Field Filter shortcode.

    You can use that to specify the field ID(s) you want to display, as well as the category your post is in (simply create a special category for that post and assign it to the post).

    For example, if you create a category called Show Me and add it to your post, your shortcode to display that particular field could look like this:

    [custom_fields_block] [ct_filter terms="show-me"] _ct_text_4cfeb3eac6f1f [/ct_filter] [/custom_fields_block]

  • Patrick
    • Support Monkey

    Hi again @ann

    Looking at that page in Firebug, I can see that the custom field block is there, but there is nothing in it.

    Could you try without the category filter please, like so?

    [custom_fields_block] _ct_text_529339cb61234 [/custom_fields_block]

    At least, this way, we can see if the custom field displays corrcetly.

  • Patrick
    • Support Monkey

    Hi again @ann

    I see what the issue is now, silly me. :slight_smile:

    We were trying to use the shortcodes to display custom fields, but they only work when used inside the post loop.

    To display custom fields outside the loop, we need to call them explicitly like so:

    <?php echo get_post_meta(23, '_ct_radio_529dbf83e2f21', true); ?>

    Where 23 is the ID of the post you want the custom field for, and _ct_radio_529dbf83e2f21 is the custom field ID from CustomPress. Replace with your own. :slight_smile:

    If you need to display multiple fields, simply copy/paste the above and swap out the IDs & keys for each. There may be a way to combine them all into one call, but I don’t know how though.

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.