Title: Creating a Shortcode Plugin
Last modified: August 30, 2016

---

# Creating a Shortcode Plugin

 *  Resolved [c.thomas](https://wordpress.org/support/users/cthomas-1/)
 * (@cthomas-1)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/creating-a-shortcode-plugin/)
 * I am having problems with creating a shortcode for a plugin that I have created.
 * GOAL: to use a shortcode to display custom fields that are within a custom post
   type (created using a custom plugin).
 * As of now, I am receiving the following parse error — UNEXPECTED END OF FILE —
   for the following code:
 *     ```
       <?php	
   
       function sc_profile_shortcode(){
   
       	wp_reset_postdata();
       				$args = array (
       					'post_type' => 'profile',
       				);
       				$the_query = new WP_Query( $args );
       			?>
   
       		<!--Custom WP_Query loop-->
       			<?php
       				if( $the_query->have_posts()) : while ( $the_query->have_posts() ) : $the_query->the_post();
       			?>
       				<?php
       					// Retrieves the stored value from the database
       				    $meta_value = get_post_meta( get_the_ID(), 'meta-text', true );
       				    // Checks and displays the retrieved value
       				    if( !empty( $meta_value ) ) {
       				?>
       				    <div class="text-center fullname">
       				    	<h1><?php echo $meta_value; ?></h1>
       				    </div>
   
       				<div class="text-center">
       				    	<h1>Cosmetology Student</h1>
       				</div>
       			<?php } endwhile; endif; // end of the loop. ?>
       }
       ```
   
 * Thanks in advance for your help.

Viewing 3 replies - 1 through 3 (of 3 total)

 *  [leejosepho](https://wordpress.org/support/users/leejosepho/)
 * (@leejosepho)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/creating-a-shortcode-plugin/#post-6465629)
 * I am not a coder, but I do know your `{` at the end of `function sc_profile_shortcode(){`
   is not being properly paired with the `}` at the end of your file. So, I am guessing
   there is a <?php -to- ?> somewhere that is not nested properly.
 *  Thread Starter [c.thomas](https://wordpress.org/support/users/cthomas-1/)
 * (@cthomas-1)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/creating-a-shortcode-plugin/#post-6465631)
 * Yes, you are right!
 * ***tired eyes need help 🙂
 * Have a good night (or day)
 * Carla
 *  [leejosepho](https://wordpress.org/support/users/leejosepho/)
 * (@leejosepho)
 * [10 years, 8 months ago](https://wordpress.org/support/topic/creating-a-shortcode-plugin/#post-6465640)
 * > ***tired eyes need help 🙂
 * I have only one eye that can read, so I cheated by using NotePad++ to just look
   at colors! 😉

Viewing 3 replies - 1 through 3 (of 3 total)

The topic ‘Creating a Shortcode Plugin’ is closed to new replies.

## Tags

 * [custom fields](https://wordpress.org/support/topic-tag/custom-fields/)

 * In: [Fixing WordPress](https://wordpress.org/support/forum/how-to-and-troubleshooting/)
 * 3 replies
 * 2 participants
 * Last reply from: [leejosepho](https://wordpress.org/support/users/leejosepho/)
 * Last activity: [10 years, 8 months ago](https://wordpress.org/support/topic/creating-a-shortcode-plugin/#post-6465640)
 * Status: resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
