Hello evolve36,
1. go to in your plugin directory and open appointment-calendar.php file
2. search comment // Including Calendar Short-Code Page
3 after this comment past all this code
[ Moderator note: code fixed. Please wrap code in the backtick character or use the code button. ]
//require_once("appointment-calendar-shortcode.php");
//require_once("appointment-calendar-mobile.php");
add_shortcode( 'APCAL_AUTO_DETECT', 'apcal_detect_device' );
function apcal_detect_device(){
if(wp_is_mobile()){ //This is mobile
// load required js css
short_code_detect();
include("appointment-calendar-mobile.php");
//Calling Calendar Mobile Shortcode function
appointment_calendar_short_code_mobile();
} else { //This is desktop system
// load required js css
short_code_detect();
include("appointment-calendar-shortcode.php");
//Calling Calendar Short-Code function
appointment_calendar_shortcode();
}
}
4. go to in line number 131 or search function short_code_detect line
and replace all function with this function code
function short_code_detect() {
global $wp_query;
$posts = $wp_query->posts;
$pattern = get_shortcode_regex();
foreach ($posts as $post){
if ( preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches )
&& array_key_exists( 2, $matches )
&& in_array( 'APCAL_PC', $matches[2] ) || in_array( 'APCAL_MOBILE', $matches[2] ) || in_array( 'APCAL', $matches[2] ) || in_array('APCAL_AUTO_DETECT', $matches[2]) )
{
wp_register_script(
'jquery-custom',
plugins_url('menu-pages/fullcalendar-assets-new/js/jquery-ui-1.8.23.custom.min.js', __FILE__),
array('jquery'),
true
);
//wp_register_script( 'jquery-custom', plugins_url('menu-pages/fullcalendar-assets-new/js/jquery-ui-1.8.23.custom.min.js', __FILE__), array('jquery'), true);
wp_enqueue_script('full-calendar',plugins_url('/menu-pages/fullcalendar-assets-new/js/fullcalendar.min.js', __FILE__),array('jquery','jquery-custom'));
wp_enqueue_script('calendar',plugins_url('calendar/calendar.js', __FILE__));
wp_enqueue_script('moment-min',plugins_url('calendar/moment.min.js', __FILE__));
wp_enqueue_style('bootstrap-apcal',plugins_url('/menu-pages/bootstrap-assets/css/bootstrap-apcal.css', __FILE__));
wp_enqueue_style('fullcalendar-css',plugins_url('/menu-pages/fullcalendar-assets-new/css/fullcalendar.css', __FILE__));
wp_enqueue_style('datepicker-css',plugins_url('/menu-pages/datepicker-assets/css/jquery-ui-1.8.23.custom.css', __FILE__));
break;
}
}
}
now you have to use this short code [APCAL_AUTO_DETECT] on your page
and you have to permission to access both devices with one short code
Thanks
Hi abhishek,
Thank you for your reply. I did make the changes you stated but the site will no longer load. When I switch back to the original “appointment-calendar.php” the site loads without issue.
Can you please let me know what you meant by this:
“you have to permission to access both devices with one short code”
Do I need to change permission settings somewhere?
Thanks
Hi abhishek,
Please ignore my previous comment, I was able to get the issue resolved. The problem was due to the cut+paste of the above code not getting copied over correctly.
The site and this feature is now working as expected now. I would highly recommend that this gets added as a standard feature of the plug-in in the next update.
Thank you again for the quick reply.