the_ID() inside shortcode
-
I want to open a lightbox-popup with Shortcodes Ultimate, but I need to insert the post-ID inside the Shortcode with “the_ID();”. This will be used inside an archive-php, so each of the shortcodes will need its own id.
Here’s my code so far:
<?php $my_shortcode = '[su_lightbox type="inline" src="#THE-ID"]'; $my_shortcode .= '+ show more'; $my_shortcode .= '[/su_lightbox]'; $my_shortcode .= '[su_lightbox_content id="THE-ID"]'; $my_shortcode .= apply_filters('the_content', get_the_content()); $my_shortcode .= '[/su_lightbox_content]'; echo do_shortcode( $my_shortcode ); ?>Does anyone know a solution for this?
Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
The topic ‘the_ID() inside shortcode’ is closed to new replies.