示例#1
0
 public static function tpl_include($template)
 {
     //checks to see if mobile theme is available
     $mobile_themes = false;
     if (file_exists(get_stylesheet_directory() . '/mobile.php') or file_exists(get_template_directory() . '/mobile.php')) {
         $mobile_themes = true;
     }
     //checks to see if mobile-phone theme is available
     $mobile_phone_themes = false;
     if (file_exists(get_stylesheet_directory() . '/mobile-phone.php') or file_exists(get_template_directory() . '/mobile-phone.php')) {
         $mobile_phone_themes = true;
     }
     if (cwp::theme_settings('offline') == 1 and !current_user_can('manage_options')) {
         self::$main_tpl = get_stylesheet_directory() . '/offline.php';
     } else {
         self::$main_tpl = $template;
     }
     self::$base_tpl = substr(basename(self::$main_tpl), 0, -4);
     if ('index' == self::$base_tpl) {
         self::$base_tpl = false;
     }
     /**
      *  check to seee if a mobile templaate exists in stylesheet dir and load
      *  to disable mobile themes create a child theme without a mobile template
      */
     if ($mobile_themes and mod_mobile::detect()->isTablet()) {
         /*
          * theme/tpl/layout/file.php -  theme/tpl/index.php
          */
         $templates = array('tpl/mobile/mobile.php');
         if (self::$base_tpl) {
             //twitter bootstrap themes
             array_unshift($templates, sprintf('tpl/mobile/tpl-mobile-%s.php', self::$base_tpl));
         }
     } elseif ($mobile_phone_themes and mod_mobile::detect()->isPhone()) {
         /*
          * theme/tpl/layout/file.php -  theme/tpl/index.php
          */
         $templates = array('tpl/mobile/phone.php');
         if (self::$base_tpl) {
             //twitter bootstrap themes
             array_unshift($templates, sprintf('tpl/mobile/tpl-phone-%s.php', self::$base_tpl));
         }
     } else {
         /*
          * theme/tpl/layout/file.php -  theme/tpl/index.php
          */
         $templates = array('tpl/themes/tpl-index.php', 'tpl/layout/tpl-index.php', 'tpl/layout/index.php');
         if (self::$base_tpl) {
             //foundation themes  - may remove foundation entirely
             //array_unshift($templates, sprintf('tpl/sample/tpl-%s.php', self::$base_tpl));
             array_unshift($templates, sprintf('tpl/layout/tpl-%s.php', self::$base_tpl));
             array_unshift($templates, sprintf('tpl/themes/tpl-%s.php', self::$base_tpl));
         }
     }
     //return locate_template($templates,true);
     self::locate_tpl($templates, null, true);
     // return self::locate_tpl($templates);
 }
}
/**
 * Bootstrap js
 *
 */
add_action('wp_enqueue_scripts', 'cwpt_bootstrap_scripts');
function cwpt_bootstrap_scripts()
{
    wp_enqueue_script('bootstrap-transition');
    wp_enqueue_script('bootstrap-dropdown');
    wp_enqueue_script('bootstrap-collapse');
}
/**
 *Mobile body class
 */
if (mod_mobile::detect()->isMobile()) {
    add_filter('body_class', 'cwpt_mobile_class');
}
function cwpt_mobile_class($classes)
{
    $classes[] = 'mobile';
    return $classes;
}
/**
 * Editor style
 */
add_editor_style('editor-style.css');
function link_excerpt_more($more)
{
    global $post;
    return '<a href="' . get_permalink($post->ID) . '"> ' . __(' Readon', 'basejump') . '  </a>';
}
/**
 * Mobile body class
 */
if (mod_mobile::detect()->isMobile()) {
    add_filter('body_class', 'cwpt_mobile_class');
}
function cwpt_mobile_class($classes)
{
    $classes[] = 'mobile';
    return $classes;
}
/**
 * Phone body class
 */
if (mod_mobile::detect()->isPhone()) {
    add_filter('body_class', 'cwpt_phone_class');
}
function cwpt_phone_class($classes)
{
    $classes[] = 'phone';
    return $classes;
}
/**
 * Editor style
 */
add_editor_style('editor-style.css');
function link_excerpt_more($more)
{
    global $post;
    return '... <span class="readon-link"> <a href="' . get_permalink($post->ID) . '">)  </a></span> ';
示例#4
0
 /**
  * adds a mobile class to the body
  */
 public static function mobile_class()
 {
     if (mod_mobile::detect()->isMobile()) {
         add_filter('body_class', array('mod_mobile', 'add_mobile_class'));
     }
 }