WordPress.org

Support

Support » Plugins and Hacks » [Resolved] Feature Suggestion: Custom Field Values

[Resolved] Feature Suggestion: Custom Field Values

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Bill Erickson

    @billerickson

    Can you give an example of how you’d use it?

    It’s a good feature request, but I’m not sure if there’s a generalized format that would work in the shortcode. For instance, you’d probably want to control its position (before/after the title, excerpt, image, content…).

    You might also want to add descriptive text to it. If the custom field holds an event’s date, you might want to preface it with “Event Date: “.

    Right now I can’t see a use of this that wouldn’t require heavy customization. The best approach right now is to use an output filter. Here’s an example (it’s not using a custom field, but gives you an idea of how to do it): http://www.billerickson.net/code/add-time-to-display-posts-shortcode/

    Yes, your example is pretty much what I’ve been doing. But, it’s a bit of pain to constantly need to update the functions.php file with output filters. What happens in that I have four or five custom post types and these custom post types have custom fields associated with them, so the function becomes a giant if/else for the output filter. It’s not a big deal, but no optimal.

    It would be great if in the shortcode, we could just reference the custom fields we want to display for the particular custom post type (custom post types are already supported in the shortcode), and the shortcode will display the custom fields in the order they were entered in the short code (after the excerpt or title of the post). In terms of descriptive text or other formatting of the custom fields, I think that is best left to the functions file, but basic output of custom fields should be in the actual shortcode.

    Thank.s

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Feature Suggestion: Custom Field Values’ is closed to new replies.