Title: Shortcode not rendering HTML
Last modified: April 15, 2019

---

# Shortcode not rendering HTML

 *  Resolved [labyrinthman](https://wordpress.org/support/users/labyrinthman/)
 * (@labyrinthman)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/shortcode-not-rendering-html/)
 * I’m developing my first plugin and the shortcode is not rendering the output,
   instead I get the name of shortcode in square brackets.
 *     ```
       function easyit_travel_shortcode($atts, $content = NULL){
   
       	$atts=shortcode_atts(array(
       		'title'=>'Travel List',
       		'count'=>10,
       		'category'=>'all'
       	),$atts);
   
       	if($atts['category']=='all'){
       		$terms='';
       	}else{
       		$terms=array(
       			array(
       				'taxonomy'=>'category',
       				'fiels'	  =>'slug',
       				'terms'	  =>$atts['category']	
       			)
       		);
       	}
   
       	$args=array(
       	'post_type'=>'travels',
       	'post_status'=>'publish',
       	'orderby'	=>'due_date',
       	'order'		=>'ASC',
       	'posts_per_page'=>$atts['count'],
       	'tax_query'		=>$terms	
       		);
   
       	$travels=new WPQuery($args);
       	$output="";
   
       	if($travels->have_posts()){
       		$travels->the_post();
   
       		$start_input=get_post_meta($post->ID,'start_input',true);
       		$end_input=get_post_meta($post->ID,'end_input',true);
       		$datepicker=get_post_meta($post->ID,'datepicker',true);
   
       		$output.="<ul>";
       		$output.="<li>".$start_input."</li>";
       		$output.="</ul>";
       		return $output;
       	}
       }
   
       add_shortcode('travels','easyit_travel_shortcode');
       ```
   
    -  This topic was modified 7 years, 1 month ago by [labyrinthman](https://wordpress.org/support/users/labyrinthman/).

Viewing 1 replies (of 1 total)

 *  Thread Starter [labyrinthman](https://wordpress.org/support/users/labyrinthman/)
 * (@labyrinthman)
 * [7 years, 1 month ago](https://wordpress.org/support/topic/shortcode-not-rendering-html/#post-11430060)
 * I have figured out myself, I have had numerous mistakes.
    Here is the working
   code.
 *     ```
       function easyit_travel_shortcode($atts, $content = NULL){
       	global $post;
       	$atts=shortcode_atts(array(
       		'title'=>'Travel List',
       		'count'=>10,
       		'category'=>'all'
       	),$atts);
   
       	if($atts['category']=='all'){
       		$terms='';
       	}else{
       		$terms=array(
       			array(
       				'taxonomy'=>'category',
       				'fiels'	  =>'slug',
       				'terms'	  =>$atts['category']	
       			)
       		);
       	}
   
       	$args=array(
       	'post_type'=>'travels',
       	'post_status'=>'publish',
       	'orderby'	=>'due_date',
       	'order'		=>'ASC',
       	'posts_per_page'=>$atts['count'],
       	'tax_query'		=>$terms	
       		);
   
       	$travels=new WP_Query($args);
       	//$output="";
   
       	if($travels->have_posts()){
   
       		while($travels->have_posts()){
   
       		$travels->the_post();
       		$start_input=get_post_meta($post->ID,'start_input',true);
       		$end_input=get_post_meta($post->ID,'end_input',true);
       		$datepicker=get_post_meta($post->ID,'datepicker',true);
       		ob_start();	?>
       		 <ul> 
       		 <li> <?php echo $start_input;?> </li>
       		 <li> <?php echo $end_input;?> </li>
       		 <li> <?php echo $datepicker;?> </li>
       		</ul> 
       	<?php }
       	wp_reset_postdata(); 
       	$content=ob_get_clean();
       	return $content;
   
       }
       }
   
       add_shortcode('travels','easyit_travel_shortcode'); 
       ```
   

Viewing 1 replies (of 1 total)

The topic ‘Shortcode not rendering HTML’ is closed to new replies.

 * In: [Developing with WordPress](https://wordpress.org/support/forum/wp-advanced/)
 * 1 reply
 * 1 participant
 * Last reply from: [labyrinthman](https://wordpress.org/support/users/labyrinthman/)
 * Last activity: [7 years, 1 month ago](https://wordpress.org/support/topic/shortcode-not-rendering-html/#post-11430060)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
