Using shortcode in single.php?
-
Hi – For layout reasons, i need to insert the shortcode directly into the single.php file. I am not able to get this to work at present.
I tried inserting the shortcode directly into the single.php file, and the code was visible in the content area rather than displaying thumbnails. I have also tried using shortcode_do for display… but this does not seem to be working, either. I used:
<?php echo do_shortcode( ‘[thumbnailgrid cat=’4′ posts=’12’ type=’post’ order_by=’date’ order=’ASC’]’ ); ?>
i also tried this – because it was in an example the wordpress site had in their instructions for shortcode_do:
<?php echo do_shortcode( ‘[thumbnailgrid cat=’4′ posts=’12’ type=’post’ order_by=’date’ order=’ASC’]’ ) ?>
then i tried using the advanced custom fields plugin to add another text field to my page that i could display separately from the main one… but it had the same results as if i had inserted the shortcode directly into single.php.
i am not really a php developer and i’m not sure what i’ve got wrong. i have been unable to find a reference in the documentation that explains what code to use to insert directly into the post code, so i’m winging it on my own here. can anyone help?
thanks!
The topic ‘Using shortcode in single.php?’ is closed to new replies.