Title: Showing syntax error
Last modified: August 30, 2016

---

# Showing syntax error

 *  Resolved [Quest Realty](https://wordpress.org/support/users/quest-realty/)
 * (@quest-realty)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/showing-syntax-error/)
 * When I try to add a code for review using schema its showing syntax error in 
   the first lin. But there is no syntax error at all.
    This is the piece of code.
 * <div itemscope itemtype=”[http://schema.org/Review”&gt](http://schema.org/Review”&gt);
   
   <div itemprop=”itemReviewed” itemscope itemtype=”[http://schema.org/LocalBusiness”&gt](http://schema.org/LocalBusiness”&gt);
   <span itemprop=”name”>Quest Realty</span> </div> <div itemprop=”name”>**Quest-
   Real Estate Listings, Home for sale, Housing Data**</div> <div itemprop=”description”
   >Your destination for all real estate listings and rental properties. Quest-amwaj.
   com provides comprehensive school and neighborhood information on houses/flats/
   apartments/commercial areas for rent/sale.</div> <div itemprop=”reviewbody”> 
   Quest realty is a reliable real estate agency for renting as well as buying properties.
   </div> <div itemprop=”author” itemscope itemtype=”[http://schema.org/Person”>Written](http://schema.org/Person”>Written)
   by: <span itemprop=”name”>CArrie Hill</span></div> <div itemprop=”author” itemscope
   itemtype=”[http://schema.org/Thing”&gt](http://schema.org/Thing”&gt); <span itemprop
   =”name”>Properties in Bahrain</span></div> <div><meta itemprop=”datePublished”
   content=”2015-05-15″>Date Published: 15/05/2015</div> <div itemprop=”reviewRating”
   itemscope itemtype=”[http://schema.org/Rating”&gt](http://schema.org/Rating”&gt);
   <meta itemprop=”worstRating” content=”0″><span itemprop=”ratingValue”>4.5</span
   > / <span itemprop=”bestRating”>5</span> stars</div> </div>
 * [https://wordpress.org/plugins/code-snippets/](https://wordpress.org/plugins/code-snippets/)

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

 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/showing-syntax-error/#post-6707713)
 * The code needs to be valid PHP code, like you could put in a plugin or a theme’s
   functions.php file.
 *  Thread Starter [Quest Realty](https://wordpress.org/support/users/quest-realty/)
 * (@quest-realty)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/showing-syntax-error/#post-6707714)
 * okie. thank you
 *  Thread Starter [Quest Realty](https://wordpress.org/support/users/quest-realty/)
 * (@quest-realty)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/showing-syntax-error/#post-6707722)
 * Can you tell me how to convert this as a valid php code?
 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/showing-syntax-error/#post-6707727)
 * You can make it into a shortcode:
 *     ```
       add_shortcode( 'schema_data', function () {
           ob_start();
           ?>
   
       <div itemscope itemtype="http://schema.org/Review">
       <div itemprop="itemReviewed" itemscope itemtype="http://schema.org/LocalBusiness">
       <span itemprop="name">Quest Realty</span>
       </div>
       <div itemprop="name">Quest-Real Estate Listings, Home for sale, Housing Data</div>
       <div itemprop="description">Your destination for all real estate listings and rental properties. Quest-amwaj.com provides comprehensive school and neighborhood information on houses/flats/apartments/commercial areas for rent/sale.</div>
       <div itemprop="reviewbody"> Quest realty is a reliable real estate agency for renting as well as buying properties.</div>
       <div itemprop="author" itemscope itemtype="http://schema.org/Person">Written by: <span itemprop="name">CArrie Hill</span></div>
       <div itemprop="author" itemscope itemtype="http://schema.org/Thing">
       <span itemprop="name">Properties in Bahrain</span></div>
       <div><meta itemprop="datePublished" content="2015-05-15">Date Published: 15/05/2015</div>
       <div itemprop="reviewRating" itemscope itemtype="http://schema.org/Rating">
       <meta itemprop="worstRating" content="0"><span itemprop="ratingValue">4.5</span> / <span itemprop="bestRating">5</span> stars</div>
       </div>
   
           <?php
           return ob_get_clean();
       } );
       ```
   
 * Then you can use the `[schema_data]` shortcode in your posts and pages.
 * If you’re interested in finding out how this PHP code works, I recommend you 
   read about [output buffering](http://php.net/manual/en/function.ob-start.php)
   and [shortcodes](http://codex.wordpress.org/Shortcode_API).
 *  Thread Starter [Quest Realty](https://wordpress.org/support/users/quest-realty/)
 * (@quest-realty)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/showing-syntax-error/#post-6707732)
 * when I add this code and activate it in the code snippet area, its showing this
   meassage: Don’t Panic
 * The code snippet you are trying to save produced a fatal error on line 2:
 * Can’t use function return value in write context
    The previous version of the
   snippet is unchanged, and the rest of this site should be functioning normally
   as before.
 * Please use the back button in your browser to return to the previous page and
   try to fix the code error. If you prefer, you can close this page and discard
   the changes you just made. No changes will be made to this site.
 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/showing-syntax-error/#post-6707746)
 * What version of PHP are you using?
 *  Thread Starter [Quest Realty](https://wordpress.org/support/users/quest-realty/)
 * (@quest-realty)
 * [10 years, 7 months ago](https://wordpress.org/support/topic/showing-syntax-error/#post-6707754)
 * PHP Version 5.4.45
 *  Plugin Author [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * (@bungeshea)
 * [10 years, 3 months ago](https://wordpress.org/support/topic/showing-syntax-error/#post-6707878)
 * Are you sure that this is all of the code that you’re using, and that the error
   isn’t coming from elsewhere? I have tried running this code multiple times, and
   I don’t know you could be getting that error from ob_start()

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

The topic ‘Showing syntax error’ is closed to new replies.

 * ![](https://ps.w.org/code-snippets/assets/icon.svg?rev=2148878)
 * [Code Snippets](https://wordpress.org/plugins/code-snippets/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/code-snippets/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/code-snippets/)
 * [Active Topics](https://wordpress.org/support/plugin/code-snippets/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/code-snippets/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/code-snippets/reviews/)

## Tags

 * [syntax error](https://wordpress.org/support/topic-tag/syntax-error/)

 * 8 replies
 * 2 participants
 * Last reply from: [Shea Bunge](https://wordpress.org/support/users/bungeshea/)
 * Last activity: [10 years, 3 months ago](https://wordpress.org/support/topic/showing-syntax-error/#post-6707878)
 * Status: resolved