stuck- shortcode inside php that is inside php?
-
I know how to call a shortcode inside php. I know how to get_template_part() in php. But how do I combine the two??
I’m using urlparams plugin to make a dynamic newsletter page for a client. So far so good- it injects the schoolname into the content easily and I figured out how to inject the correct school banner image using the php echo do_shortcode.
But- now I need to pull in a custom template part based on the schoolname variable with urlparam. This has been stopping me at every turn.
When I do this:
<?php get_template_part( '. echo do_shortcode('[urlparam param="schoolname" /]').'); ?>I get an unexpected error for the [
When I do this,
<?php get_template_part( 'echo .urlparams(param="schoolname").'); ?>I don’t get the errors, but the links do not show up in the page…
Can someone please tell me if what I am doing is impossible or if I’m missing something… I planned to have a php file for each school so that it was just a little section being included in the page with their school specific links.
thank you!!
((Probably way too much extra info, but in case you need it, the first page in which they choose their school and the url param is passed is http://www.lunchtimesolutions.com/new/index.php/district-newsletters and the page that I’m having issues pulling the template part into is http://www.lunchtimesolutions.com/new/index.php/current-newsletter – and the test file I set up for the schools is for Vermillion school, located here: http://www.lunchtimesolutions.com/new/wp-content/themes/twentyten/Vermillion.php ))
The topic ‘stuck- shortcode inside php that is inside php?’ is closed to new replies.