• Resolved Bambalazs

    (@bambalazs)


    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/

Viewing 2 replies - 1 through 2 (of 2 total)
  • Plugin Author Thomas Griffin

    (@griffinjt)

    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

    (@bambalazs)

    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.