WordPress.org

Ready to get started?Download WordPress

Forums

Display Posts Shortcode
[resolved] Custom fields clarification (2 posts)

  1. peterprossedi
    Member
    Posted 2 years ago #

    hi everyone........and Bill great plugin......

    im using your plugin to display numerous lists on the same page some of which i want to show a custom field and some not. Ive used your filter (https://gist.github.com/1209601) successfully its just that this way the code is always automatically showing. how can i add the extension to the shortcode to show something like custom_field_name="true" to activate it.

    also it is also importing the <p> tags from the text i am calling.

    http://wordpress.org/extend/plugins/display-posts-shortcode/

  2. Bill Erickson
    Member
    Plugin Author

    Posted 2 years ago #

    If you pass an additional parameter to the shortcode, it will be available in $atts. So before you display your custom field, check for something like:

    if( isset( $atts['custom_field_name'] ) && "true" == $atts['custom_field_name'] )
    	echo $my_custom_field;

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.