Note that there are some explanatory texts on larger screens.

plurals
  1. POCustom Fields - Boolean Display of True/False to Yes/No
    text
    copied!<p>I am importing fields from a Real Estate site. </p> <p>The Import of one Custom Field looks like this...</p> <p>Field Name after Import ---> assistedLiving Field Value ---> false</p> <p>to output the display in wordpress i use this...</p> <pre><code>&lt;?php global $wp_query; $postid = $wp_query-&gt;post-&gt;ID; if ($immopress_property['assistedLiving']): ?&gt; &lt;li class="assistedLiving"&gt; &lt;span class="attribute" style="width:200px;display:block;float:left;"&gt;&lt;?php echo 'Seniorengerechtes Wohnen' ; ?&gt;&lt;span class="wpp_colon"&gt;:&lt;/span&gt;&lt;/span&gt; &lt;span class="value"&gt;&lt;?php echo get_post_meta($post-&gt;ID, 'assistedLiving' , true); ?&gt;&amp;nbsp;&lt;/span&gt; &lt;/li&gt; &lt;?php wp_reset_query(); ?&gt; &lt;?php endif; ?&gt; </code></pre> <p>The Result on Site looks so...</p> <pre><code>**Seniorengerechtes Wohnen:false** </code></pre> <p><strong>How can i display False/True Values to display Yes/No or in German Ja/NEIN?</strong></p> <p>The Funktion to display all Field (Display it Right with yes/no):</p> <pre><code>function immopress_the_fields( $args ) { global $post, $ImmoPress; extract( wp_parse_args( $args, array ( 'id' =&gt; $post-&gt;ID, 'exclude' =&gt; $exclude, 'echo' =&gt; TRUE ) ), EXTR_SKIP ); $fields = immopress_get_fields( $args ); if ( !$fields ) return false; $output = ''; $output .= '&lt;ul class="immopress-fields"&gt;'; foreach ( $fields as $key =&gt; $value) { $entry = $ImmoPress-&gt;values[$value]; if ( $entry == '') $entry = $value; $output .= "&lt;li class='immopress-field-$key'&gt;"; $output .= "&lt;strong class='immopress-key'&gt;{$ImmoPress-&gt;fields[$key]}: &lt;/strong&gt;"; $output .= "&lt;span class='immopress-value'&gt;$entry&lt;/span&gt;"; $output .= "&lt;/li&gt;"; } $output .= '&lt;/ul&gt;'; if ( $echo ) { echo $output; } else { return $output; } </code></pre> <p><strong>But i need to display only Single Name &amp; Values not all importet fields.</strong></p> <p>Code for the Shortcode..</p> <pre><code>function immopress_fields_shortcode( $atts ) { $args = wp_parse_args( $atts, array ( 'echo' =&gt; FALSE ) ); return immopress_the_fields( $args ); } add_shortcode( 'immopress_fields', 'immopress_fields_shortcode' ); </code></pre> <p>Hope someone can Help me with that.</p> <p>Thanks</p> <p>Tony</p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload