• sashafelix

    (@sashafelix)


    Hi

    how can i have one menu link and have both the desktop and mobile versions link to the single page.

    when i access it on a desktop the normal page should load and when i access the same page on a mobile device the mobile calendar should load.

    please any assistance would be greatly appreciated.

    Regards

    https://ww.wp.xz.cn/plugins/appointment-calendar/

Viewing 2 replies - 1 through 2 (of 2 total)
  • abhishek

    (@abhipathak)

    Hi sashafelix,

    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

    //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
    Abhishek

    Thread Starter sashafelix

    (@sashafelix)

    Thank, worked like a charm

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘mobile and desktop shortcode’ is closed to new replies.