Calling wordpress shortcodes from within PHP code

I was looking for a way to display my linked in profile in the sidebar. sidebar.php template needed to be edited – but I wasn’t sure how to call the shortcode (li_card) from within the template….
I discovered the do_shortcode function – which worked just as advertised…
<?php echo do_shortcode("[shortcode]"); ?>

Working Example (shortcode linkedin card )

 
<?php echo do_shortcode("
Anuj Varma
CxO Technology Confidant, Cloud and Security Strategy Specialist
ANUJ Technologies - Simplifying Cloud and Application Architecture
"); ?>

Specializing in high volume web and cloud application architecture, Anuj Varma’s customer base includes Fortune 100 companies (dell.com, British Petroleum, Schlumberger).

For Anuj’s popular, one-on-one executive tech seminars, visit ANUJ.COM

All content on this site is original and owned by AdverSite Web Holdings, Inc. – the parent company of anujvarma.com. No part of it may be reproduced without EXPLICIT consent from the owner of the content.

Anuj Varma – who has written posts on Anuj Varma, Technology Architect.


Leave a Reply

Your email address will not be published. Required fields are marked *