php - Wordpress "do_shortcode" in custom page template -


i trying create custom page template using shortcode plugin shift controller

the shortcode "[shiftcontroller]" , takes location attribute can show shifts specific location this: "[shiftcontroller location="2"]" 2 location id. have added custom user filed called "locationid" can use value shortcode show shifts specific location current user.

this page template code far:

<?php /* template name: custom shift controller page */ get_header(); ?>  <?php do_action( 'flatsome_before_page' ); ?>  <div id="content" role="main" class="content-area">          <?php while ( have_posts() ) : the_post(); ?>              <?php                 $client_user = wp_get_current_user();                 $user_id = $client_user->id;                 $key = 'locationid';                 $single = true;                  $client_location_id = get_user_meta( $user_id, $key, $single );                  echo '<h2 class="" style="text-align: center;">manage, view , book shifts</h2>';                 echo '<h1>the client location id: ' . $client_location_id . '</h1>';                 echo do_shortcode('[shiftcontroller location="' . $client_location_id . '"]');                 // echo do_shortcode('[shiftcontroller]');                 // echo apply_filters( 'the_content', '[shiftcontroller]');             ?>          <?php endwhile; // end of loop. ?>  </div>  <?php do_action( 'flatsome_after_page' ); ?>  <?php get_footer(); ?> 

i'm echoing h1 can confirm location id , working correctly. however, shift calendar should show not showing @ all. without custom locationid code, echo do_shortcode('[shiftcontroller]'); still not displaying calendar.

any ideas on why shortcode won't work? shift calendar uses ajax don't know if may causing issue. thanks

you there in commented code. have apply correct filters. instead of using echo do_shortcode();, try:

echo apply_filters('the_content', '[shiftcontroller location="' . $client_location_id . '"]'); 

Comments

Popular posts from this blog

Is there a better way to structure post methods in Class Based Views -

performance - Why is XCHG reg, reg a 3 micro-op instruction on modern Intel architectures? -

jquery - Responsive Navbar with Sub Navbar -