function swell_setup() { // 1.2.1 Set Globals global $ttrust_config; $ttrust_config['theme'] = 'Swell '; $ttrust_config['version'] = '1.0'; // 1.2.2 Make theme available for translation. load_theme_textdomain('swell', get_template_directory() . '/languages'); // 1.2.3 Add default posts and comments RSS feed links to head. add_theme_support('automatic-feed-links'); // 1.2.4 Add support for thumbnails add_theme_support('post-thumbnails'); // 1.2.5 This theme uses wp_nav_menu() in one location. register_nav_menus(array('primary' => __('Main Menu', 'swell'))); // 1.2.6 Enable support for Post Formats (currently disabled). //add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) ); // 1.2.7 Load and instantiate the Portfolio CPT Class v1.0 -- Warning: WP<3.8 requires images/blue-folder-stand.png load_template(get_template_directory() . '/inc/class-portfolio-cpt.php', true); $portfolio_cpt = new Portfolio_CPT('swell'); // Sending in the textdomain $portfolio_cpt->project_init(); $portfolio_cpt->skills_init(); // 1.2.8 Load and instantiate the Testimonial CPT Class v1.0 -- Warning: WP<3.8 requires images/user-icon.png load_template(get_template_directory() . '/inc/class-testimonial-cpt.php', true); $testimonial_cpt = new Testimonial_CPT('swell'); // Sending in the textdomain $testimonial_cpt->testimonial_init(); // 1.2.9 Enable Featured Content add_theme_support('featured-content', array('filter' => 'swell_get_featured_posts', 'max_posts' => get_theme_mod('swell_featured_pages_count'), 'post_types' => array('post', 'page'))); // 1.2.10 Setup the WordPress Core custom background feature. add_theme_support('custom-background', apply_filters('swell_custom_background_args', array('default-color' => 'ffffff', 'default-image' => ''))); // 1.2.11 Enable support for HTML5 markup. add_theme_support('html5', array('comment-list', 'search-form', 'comment-form', 'gallery', 'caption')); // 1.2.12 Add Menus function mobile_nav() { echo '<ul>'; wp_list_pages('sort_column=menu_order&title_li='); echo '</ul>'; } function main_nav() { echo '<nav id="main-menu"><ul class="sf-menu clearfix">'; wp_list_pages('sort_column=menu_order&title_li='); echo '</ul></nav>'; } }
function create_setup() { // 1.2.1 Set Globals & Variables global $ttrust_config; $ttrust_config['theme'] = 'create '; $ttrust_config['version'] = '1.0'; // Demo Importer */ require_once get_template_directory() . '/inc/demo-import/demo-import.php'; // 1.2.2 Make theme available for translation. load_theme_textdomain('create', get_template_directory() . '/languages'); // 1.2.3 Add default posts and comments RSS feed links to head. add_theme_support('automatic-feed-links'); // 1.2.4 Add support for thumbnails add_theme_support('post-thumbnails'); // Add Post Image Sizes add_image_size('create_thumb_square', 700, 700, true); add_image_size('create_thumb_landscape', 800, 600, true); add_image_size('create_thumb_portrait', 600, 800, true); add_image_size('create_thumb_wide', 1000, 500, true); add_image_size('create_thumb_tall', 500, 1000, true); add_image_size('create_thumb_wide_tall', 1000, 1000, true); // 1.2.5 This theme uses wp_nav_menu() in one location. register_nav_menus(array('primary' => __('Main Menu', 'create'), 'slide_panel' => __('Slide Panel Desktop', 'create'), 'slide_panel_mobile' => __('Slide Panel Mobile', 'create'), 'left' => __('Left Menu (Split Header)', 'create'))); // 1.2.6 Enable support for Custom Backgrounds // only enabled if layout mode is boxed. if (get_theme_mod('create_site_width') == "boxed") { add_theme_support('custom-background'); } // 1.2.6 Enable support for Post Formats (currently disabled). //add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link' ) ); // 1.2.7 Load theme custom post types load_template(get_template_directory() . '/inc/class-portfolio-cpt.php', true); $portfolio_cpt = new Portfolio_CPT('create'); // Sending in the textdomain $portfolio_cpt->project_init(); $portfolio_cpt->skills_init(); load_template(get_template_directory() . '/inc/class-testimonial-cpt.php', true); $testimonial_cpt = new Testimonial_CPT('create'); // Sending in the textdomain $testimonial_cpt->testimonial_init(); // 1.2.11 Enable support for HTML5 markup. add_theme_support('html5', array('comment-list', 'search-form', 'comment-form', 'gallery', 'caption')); // Add WooCommerce Support add_theme_support('woocommerce'); // 1.2.12 Add Menus // 1.2.3 Add custom Page Builder functions load_template(get_template_directory() . '/inc/custom-page-builder.php', true); // 1.2.4 Add custom Page Builder Widgets load_template(get_template_directory() . '/inc/page-builder-widgets/woocommerce-products.php', true); load_template(get_template_directory() . '/inc/page-builder-widgets/portfolio.php', true); load_template(get_template_directory() . '/inc/page-builder-widgets/testimonials.php', true); load_template(get_template_directory() . '/inc/page-builder-widgets/blog.php', true); load_template(get_template_directory() . '/inc/page-builder-widgets/spacer.php', true); load_template(get_template_directory() . '/inc/page-builder-widgets/so-price-table-widget/so-price-table-widget.php', true); // 1.2.4.1 Add custom sidebars load_template(get_template_directory() . '/inc/custom-sidebars.php', true); // 1.2.5 Enable shortcodes in text widget add_filter('widget_text', 'do_shortcode'); // 1.2.6 Metaboxes load_template(get_template_directory() . '/inc/metaboxes.php', true); // 1.2.7 Add custom body and post classes function create_body_class($classes) { global $is_lynx, $is_gecko, $is_IE, $is_opera, $is_NS4, $is_safari, $is_chrome, $is_iphone; if ($is_lynx) { $classes[] = 'lynx'; } elseif ($is_gecko) { $classes[] = 'gecko'; } elseif ($is_opera) { $classes[] = 'opera'; } elseif ($is_NS4) { $classes[] = 'ns4'; } elseif ($is_safari) { $classes[] = 'safari'; } elseif ($is_chrome) { $classes[] = 'chrome'; } elseif ($is_IE) { $classes[] = 'ie'; if (preg_match('/MSIE ([0-9]+)([a-zA-Z0-9.]+)/', $_SERVER['HTTP_USER_AGENT'], $browser_version)) { $classes[] = 'ie' . $browser_version[1]; } } else { $classes[] = 'unknown'; } if ($is_iphone) { $classes[] = 'iphone'; } if (stristr($_SERVER['HTTP_USER_AGENT'], "mac")) { $classes[] = 'osx'; } elseif (stristr($_SERVER['HTTP_USER_AGENT'], "linux")) { $classes[] = 'linux'; } elseif (stristr($_SERVER['HTTP_USER_AGENT'], "windows")) { $classes[] = 'windows'; } $site_container = get_theme_mod('create_site_width', ''); $header_position = 'top-header'; $header_layout = get_theme_mod('create_header_top_layout', 'inline-header'); $header_sticky = get_theme_mod('create_sticky_header', ''); $classes[] = $site_container; $classes[] = $header_position; $classes[] = $header_layout; $classes[] = $header_sticky; return $classes; } add_filter('body_class', 'create_body_class'); function create_post_class($classes) { global $post; $full_width_content = get_post_meta($post->ID, '_create_post_full_width', true); if ($full_width_content == 'yes') { $classes[] = "full"; } return $classes; } add_filter('post_class', 'create_post_class'); }