console.dir($data)"; } /** * Customizer additions. */ include get_template_directory() . '/customizer.php'; /*------------------------------------*\ Theme Support \*------------------------------------*/ if (!isset($content_width)) { $content_width = 900; } if (function_exists('add_theme_support')) { // Add Menu Support add_theme_support('menus'); // Add Thumbnail Theme Support add_theme_support('post-thumbnails'); add_image_size('large', 700, '', true); // Large Thumbnail add_image_size('medium', 250, '', true); // Medium Thumbnail add_image_size('small', 120, '', true); // Small Thumbnail add_image_size('home-big-thumbnail', 1280, 1280, true); // Custom Thumbnail Size call using the_post_thumbnail('home-thumbnail'); add_image_size('home-small-thumbnail', 256, 256, true); // Custom Thumbnail Size call using the_post_thumbnail('home-thumbnail'); add_image_size('home-event-thumbnail', 1024, 537, true); add_image_size('single-thumbnail', 1280, 1280, true); // Add Support for Custom Backgrounds - Uncomment below if you're going to use /*add_theme_support('custom-background', array( 'default-color' => 'FFF', 'default-image' => get_template_directory_uri() . '/img/bg.jpg' ));*/ // Add Support for Custom Header - Uncomment below if you're going to use /*add_theme_support('custom-header', array( 'default-image' => get_template_directory_uri() . '/img/headers/default.jpg', 'header-text' => false, 'default-text-color' => '000', 'width' => 1000, 'height' => 198, 'random-default' => false, 'wp-head-callback' => $wphead_cb, 'admin-head-callback' => $adminhead_cb, 'admin-preview-callback' => $adminpreview_cb ));*/ // Enables post and comment RSS feed links to head add_theme_support('automatic-feed-links'); // Localisation Support load_theme_textdomain('dis2019', get_template_directory() . '/languages'); } /*------------------------------------*\ Functions \*------------------------------------*/ // dis-2019 navigation function dis2019_nav() { wp_nav_menu( array( 'theme_location' => 'header-menu', 'menu' => '', 'container' => 'div', 'container_class' => 'menu-{menu slug}-container', 'container_id' => '', 'menu_class' => 'menu', 'menu_id' => '', 'echo' => true, 'fallback_cb' => 'wp_page_menu', 'before' => '', 'after' => '', 'link_before' => '', 'link_after' => '', 'items_wrap' => '
' . $output . '
'; echo $output; } // Custom View Article link to Post function dis_blank_view_article($more) { global $post; return '... ' . __('View Article', 'dis2019') . ''; } // Remove Admin bar function remove_admin_bar() { return false; } // Remove 'text/css' from our enqueued stylesheet function dis_style_remove($tag) { return preg_replace('~\s+type=["\'][^"\']++["\']~', '', $tag); } // Remove thumbnail width and height dimensions that prevent fluid images in the_thumbnail function remove_thumbnail_dimensions($html) { $html = preg_replace('/(width|height)=\"\d*\"\s/', "", $html); return $html; } //Wrap aligned images to a div function wrap_aligned_images($content) { return preg_replace('/
tags in Dynamic Sidebars (better!) add_filter('wp_nav_menu_args', 'my_wp_nav_menu_args'); // Remove surrounding
tags in Excerpt (Manual Excerpts only) add_filter('the_excerpt', 'do_shortcode'); // Allows Shortcodes to be executed in Excerpt (Manual Excerpts only) add_filter('excerpt_more', 'dis_blank_view_article'); // Add 'View Article' button instead of [...] for Excerpts add_filter('show_admin_bar', 'remove_admin_bar'); // Remove Admin bar add_filter('style_loader_tag', 'dis_style_remove'); // Remove 'text/css' from enqueued stylesheet add_filter('post_thumbnail_html', 'remove_thumbnail_dimensions', 10); // Remove width and height dynamic attributes to thumbnails add_filter('image_send_to_editor', 'remove_thumbnail_dimensions', 10); // Remove width and height dynamic attributes to post images // Remove Filters remove_filter('the_excerpt', 'wpautop'); // Remove
tags from Excerpt altogether // Shortcodes add_shortcode('dis_shortcode_demo', 'dis_shortcode_demo'); // You can place [dis_shortcode_demo] in Pages, Posts now. add_shortcode('dis_shortcode_demo_2', 'dis_shortcode_demo_2'); // Place [dis_shortcode_demo_2] in Pages, Posts now. // Shortcodes above would be nested like this - // [dis_shortcode_demo] [dis_shortcode_demo_2] Here's the page title! [/dis_shortcode_demo_2] [/dis_shortcode_demo] /*------------------------------------*\ Custom Post Types \*------------------------------------*/ // Create 1 Custom Post type for a Demo, called HTML5-Blank // function create_post_type_dis() // { // register_taxonomy_for_object_type('category', 'dis-blank'); // Register Taxonomies for Category // register_taxonomy_for_object_type('post_tag', 'dis-blank'); // register_post_type('dis-blank', // Register Custom Post Type // array( // 'labels' => array( // 'name' => __('dis-2019 Custom Post', 'dis2019'), // Rename these to suit // 'singular_name' => __('dis-2019 Custom Post', 'dis2019'), // 'add_new' => __('Add New', 'dis2019'), // 'add_new_item' => __('Add New dis-2019 Custom Post', 'dis2019'), // 'edit' => __('Edit', 'dis2019'), // 'edit_item' => __('Edit dis-2019 Custom Post', 'dis2019'), // 'new_item' => __('New dis-2019 Custom Post', 'dis2019'), // 'view' => __('View dis-2019 Custom Post', 'dis2019'), // 'view_item' => __('View dis-2019 Custom Post', 'dis2019'), // 'search_items' => __('Search dis-2019 Custom Post', 'dis2019'), // 'not_found' => __('No dis-2019 Custom Posts found', 'dis2019'), // 'not_found_in_trash' => __('No dis-2019 Custom Posts found in Trash', 'dis2019') // ), // 'public' => true, // 'hierarchical' => true, // Allows your posts to behave like Hierarchy Pages // 'has_archive' => true, // 'supports' => array( // 'title', // 'editor', // 'excerpt', // 'thumbnail' // ), // Go to Dashboard Custom dis-2019 post for supports // 'can_export' => true, // Allows export in Tools > Export // 'taxonomies' => array( // 'post_tag', // 'category' // ) // Add Category and Post Tags support // )); // } /*------------------------------------*\ ShortCode Functions \*------------------------------------*/ // Shortcode Demo with Nested Capability function dis_shortcode_demo($atts, $content = null) { return '