• Resolved alwilk

    (@alwilk)


    I was wondering whether there is a php version of the shortcode so that I can add a php variable for the image id? Or is there a way to insert the php variable into the shortcode itself?

    Basically the variable would be the image id of the uploaded image to the post

    <?php $awb_image = the_field( ‘hero_image’ ); ?>

    And I would like this variable to be passed into the shortcode here:

    <?php echo do_shortcode( ‘[nk_awb awb_type=”image” awb_image=”$awb_image” awb_image_size=”full” awb_image_background_size=”cover” awb_image_background_position=”50% 50%” awb_parallax=”scroll” awb_parallax_speed=”0.5″]<p>some stuff here</p>[/nk_awb]’ ); ?>

    Although this doesn’t work obviously…

    Thanks, I really love to plugin and would like to find a way to continue using it!

Viewing 1 replies (of 1 total)
  • Plugin Author Nikita

    (@nko)

    Hi.

    This code should work:

    <?php echo do_shortcode('[nk_awb awb_type="image" awb_image="' . $awb_image . '" awb_image_size="full" awb_image_background_size="cover" awb_image_background_position="50% 50%" awb_parallax="scroll" awb_parallax_speed="0.5"]<p>some stuff here</p>[/nk_awb]'); ?>

    p.s. I apologize for a delay in reply, didn’t get any notification about it…

Viewing 1 replies (of 1 total)
  • The topic ‘php version of the shortcode’ is closed to new replies.