WordPress.org

Ready to get started?Download WordPress

Forums

Types - Custom Fields and Custom Post Types Management
[resolved] Add content before or after date fi (2 posts)

  1. Eckstein
    Member
    Posted 1 year ago #

    I am wondering if it's possible to include html before or after the output of a date field. Specifically, I'm trying to at a "-" before a certain date but ONLY if that date is filled in, otherwise I don't want the dash.

    Is that possible? Even if someone has some php I can use outside of the scope of Types.

    Thanks!

    http://wordpress.org/extend/plugins/types/

  2. AmirHelzer
    Member
    Plugin Author

    Posted 1 year ago #

    If you're using Types API functions to display fields, you can certainly output any text/HTML before and after field values.

    To make this conditional upon field values, you'll need to load the field via the standard WordPress API (get_post_meta - http://codex.wordpress.org/Function_Reference/get_post_meta ), check its value and do whatever other processing you want.

    You can also use Views to do all this output. This way, you can create elaborate output without any PHP. With Views, you can use conditional output to achieve what you're asking here. See this for conditional output using Views:
    http://wp-types.com/documentation/user-guides/conditional-html-output-in-views/

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.