Title: PHP code with custom post meta
Last modified: August 20, 2016

---

# PHP code with custom post meta

 *  Resolved [Bambalazs](https://wordpress.org/support/users/bambalazs/)
 * (@bambalazs)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/php-code-with-custom-post-meta/)
 * Hello. First of all, thank you for this great plugin. 🙂
 * My problem is that I’m beginner in php. I have no clue how to implement custom
   post meta value inside the php single qoutes.
 * This is the custom post meta (gallery is ID of Soliloquy):
 *     ```
       <?php get_post_meta($post->ID, 'gallery') ?>
       ```
   
 * And this is the original php code:
 *     ```
       <?php if ( function_exists( 'soliloquy_slider' ) ) soliloquy_slider( '248' ); ?>
       ```
   
 * I created this, but it is not working because single quotes.
 *     ```
       <?php $soliloquy = get_post_meta($post->ID, 'gallery') ?>
       <?php if ( function_exists( 'soliloquy_slider' ) ) soliloquy_slider( '$soliloquy' ); ?>
       ```
   
 * Could you help me to get working code? 🙂
 * [http://wordpress.org/extend/plugins/soliloquy-lite/](http://wordpress.org/extend/plugins/soliloquy-lite/)

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

 *  [Thomas Griffin](https://wordpress.org/support/users/griffinjt/)
 * (@griffinjt)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/php-code-with-custom-post-meta/#post-3582746)
 * Here is what you need:
 *     ```
       <?php $soliloquy = get_post_meta( $post->ID, 'gallery', true ); ?>
       <?php if ( function_exists( 'soliloquy_slider' ) ) soliloquy_slider( $soliloquy ); ?>
       ```
   
 * That should get you working correctly. You need the `true` as the last parameter
   of `get_post_meta` in order to return a single value instead of the default array
   value from the database. Also, you don’t need quotes around variables when you
   are passing them as a function parameter.
 * If you dig Soliloquy, a 5-star rating would rock! 🙂
 *  Thread Starter [Bambalazs](https://wordpress.org/support/users/bambalazs/)
 * (@bambalazs)
 * [13 years, 2 months ago](https://wordpress.org/support/topic/php-code-with-custom-post-meta/#post-3582747)
 * Thank you, it works.
 * You’ll get five stars, I’m sure. 😉

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

The topic ‘PHP code with custom post meta’ is closed to new replies.

 * ![](https://ps.w.org/soliloquy-lite/assets/icon-256x256.png?rev=979373)
 * [Slider by Soliloquy - Responsive Image Slider for WordPress](https://wordpress.org/plugins/soliloquy-lite/)
 * [Frequently Asked Questions](https://wordpress.org/plugins/soliloquy-lite/#faq)
 * [Support Threads](https://wordpress.org/support/plugin/soliloquy-lite/)
 * [Active Topics](https://wordpress.org/support/plugin/soliloquy-lite/active/)
 * [Unresolved Topics](https://wordpress.org/support/plugin/soliloquy-lite/unresolved/)
 * [Reviews](https://wordpress.org/support/plugin/soliloquy-lite/reviews/)

## Tags

 * [php](https://wordpress.org/support/topic-tag/php/)
 * [post](https://wordpress.org/support/topic-tag/post/)
 * [soliloquy](https://wordpress.org/support/topic-tag/soliloquy/)

 * 2 replies
 * 2 participants
 * Last reply from: [Bambalazs](https://wordpress.org/support/users/bambalazs/)
 * Last activity: [13 years, 2 months ago](https://wordpress.org/support/topic/php-code-with-custom-post-meta/#post-3582747)
 * Status: resolved