Title: Problem with custom post &amp; shortcode
Last modified: August 21, 2016

---

# Problem with custom post & shortcode

 *  [nicart](https://wordpress.org/support/users/nicart/)
 * (@nicart)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/problem-with-custom-post-shortcode/)
 * Hello,
    I try to change : `<?php echo do_shortcode( '[ingredients]' ) ?>`
 * This is a multiple values list, but I don’t manage to change it.
 * The shortcode is here :
 *     ```
       // [ingredients] short code
       function show_ingredients($atts, $content = null) {
   
       	extract(shortcode_atts(array(
       									'title' => ''
       								), $atts));
   
       	global $post;		
   
       	$ingredients = get_post_meta($post->ID, 'RECIPE_META_ingredients');	
   
       	$ingredients_count = count($ingredients[0]);
   
       	if(empty($title))
       	{
       		$ingredients_html = '<h3>'.__('Ingredients','woothemes').'</h3>';
       	}else{
       		$ingredients_html = '<h3>'.$title.'</h3>';
       	}
   
       	if( $ingredients_count >= 1 && (!empty($ingredients[0][0])) )
       	{
       		$i = 0;
       		$ingredients_html .= '<ul class="ingre">';
   
       		while($i < $ingredients_count)
       		{
       			$ingredients_html .= '<li> ';
       			$ingredients_html .= $ingredients[0][$i];
       			$ingredients_html .= '</li>';
       			$i++;
       		}
   
       		$ingredients_html .= '</ul>';
       	}
       	else
       	{
       		$ingredients_html .= '<p>';
       		$ingredients_html .= __('No Ingredients Found ! ','woothemes');
       		$ingredients_html .= '</p>';
       	}
   
       	return $ingredients_html;
   
       }
       add_shortcode('ingredients', 'show_ingredients');
       ```
   
 * I tried to change almost anything but I don’t manage to succeed.
 * For example the :
 *     ```
       <ul>
       <?php
       $values = get_editable_post_meta( get_the_ID(), 'my_key' );
       foreach ( $values as $value )
           echo '<li>' . $value . '</li>';
       ?>
       </ul>
       ```
   
 * make this error :
    `Warning: scalar expected. array given in /homepages/3/d440635061/
   htdocs/recette-vegan/wp-content/plugins/front-end-editor/php/fields/base.php 
   on line 78` The only thing I can modify is the word Array…
 * Can someone help me ?
    Thank you
 * [https://wordpress.org/plugins/front-end-editor/](https://wordpress.org/plugins/front-end-editor/)

Viewing 1 replies (of 1 total)

 *  Thread Starter [nicart](https://wordpress.org/support/users/nicart/)
 * (@nicart)
 * [12 years, 2 months ago](https://wordpress.org/support/topic/problem-with-custom-post-shortcode/#post-4726733)
 * Of course the code added was :
 *     ```
       <?php
       $values = get_editable_post_meta(get_the_ID(), 'RECIPE_META_ingredients' );
       foreach ( $values as $value )
           echo '<li>' . $value . '</li>';
       ?>
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Problem with custom post & shortcode’ is closed to new replies.

 * ![](https://s.w.org/plugins/geopattern-icon/front-end-editor.svg)
 * [Front-end Editor](https://wordpress.org/plugins/front-end-editor/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/front-end-editor/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/front-end-editor/)
 * [Active Topics](https://wordpress.org/support/plugin/front-end-editor/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/front-end-editor/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/front-end-editor/reviews/)

 * 1 reply
 * 1 participant
 * Last reply from: [nicart](https://wordpress.org/support/users/nicart/)
 * Last activity: [12 years, 2 months ago](https://wordpress.org/support/topic/problem-with-custom-post-shortcode/#post-4726733)
 * Status: not resolved