for posts and comments. add_theme_support( 'automatic-feed-links' ); // Enable support for Post Thumbnails, and declare two sizes. add_theme_support( 'post-thumbnails' ); set_post_thumbnail_size( 672, 372, true ); add_image_size( 'twentyfourteen-full-width', 1038, 576, true ); // This theme uses wp_nav_menu() in two locations. register_nav_menus( array( 'primary' => __( 'Top primary menu', 'twentyfourteen' ), 'secondary' => __( 'Secondary menu in left sidebar', 'twentyfourteen' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', ) ); } endif; // twentyfourteen_setup add_action( 'after_setup_theme', 'twentyfourteen_setup' ); /** * Enqueue scripts and styles for the front end. * @since Twenty Fourteen 1.0 * @return void */ function twentyfourteen_scripts() { // Load our main stylesheet. wp_enqueue_style( 'twentyfourteen-style', get_stylesheet_uri() ); // Load the Internet Explorer specific stylesheet. wp_enqueue_style( 'twentyfourteen-ie', get_template_directory_uri() . '/css/ie.css', array( 'twentyfourteen-style' ), '20131205' ); wp_style_add_data( 'twentyfourteen-ie', 'conditional', 'lt IE 9' ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } wp_enqueue_script( 'twentyfourteen-script', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), '20131209', true ); } add_action( 'wp_enqueue_scripts', 'twentyfourteen_scripts' ); /** * Extend the default WordPress body classes. * Adds body classes to denote: * 1. Single or multiple authors. * 2. Presence of header image. * 3. Index views. * 4. Full-width content layout. * 5. Presence of footer widgets. * 6. Single views. * 7. Featured content layout. * @since Twenty Fourteen 1.0 * @param array $classes A list of existing body class values. * @return array The filtered body class list. */ function twentyfourteen_body_classes( $classes ) { if ( is_multi_author() ) { $classes[] = 'group-blog'; } if ( is_archive() || is_search() || is_home() ) { $classes[] = 'list-view'; } if ( is_singular() && ! is_front_page() ) { $classes[] = 'singular'; } return $classes; } add_filter( 'body_class', 'twentyfourteen_body_classes' ); /** * Extend the default WordPress post classes. * Adds a post class to denote: * Non-password protected page with a post thumbnail. * @since Twenty Fourteen 1.0 * @param array $classes A list of existing post class values. * @return array The filtered post class list. */ function twentyfourteen_post_classes( $classes ) { if ( ! post_password_required() && has_post_thumbnail() ) { $classes[] = 'has-post-thumbnail'; } return $classes; } add_filter( 'post_class', 'twentyfourteen_post_classes' ); /** * Create a nicely formatted and more specific title element text for output * in head of document, based on current view. * @since Twenty Fourteen 1.0 * @param string $title Default title text for current view. * @param string $sep Optional separator. * @return string The filtered title. */ function twentyfourteen_wp_title( $title, $sep ) { global $paged, $page; if ( is_feed() ) { return $title; } // Add the site name. $title .= get_bloginfo( 'name' ); // Add the site description for the home/front page. $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) { $title = "$title $sep $site_description"; } // Add a page number if necessary. if ( $paged >= 2 || $page >= 2 ) { $title = "$title $sep " . sprintf( __( 'Page %s', 'twentyfourteen' ), max( $paged, $page ) ); } return $title; } add_filter( 'wp_title', 'twentyfourteen_wp_title', 10, 2 ); function basic_template_scripts() { wp_deregister_script( 'jquery' ); // jQuery wp_register_script( 'jquery', '//ajax.googleapis.com/ajax/libs/jquery/1.10.1/jquery.min.js' ); wp_enqueue_script( 'jquery' ); wp_deregister_script( 'jquery-ui' ); // jQuery UI wp_register_script( 'jquery-ui', '//ajax.googleapis.com/ajax/libs/jqueryui/1.10.3/jquery-ui.min.js', array( 'jquery' ) ); wp_enqueue_script( 'jquery-ui' ); wp_deregister_script( 'nivoslider' ); // nivoSlider wp_register_script( 'nivoslider', get_bloginfo('template_directory') . '/js/jquery.nivo.slider.pack.js', array( 'jquery' ) ); wp_enqueue_script( 'nivoslider' ); wp_deregister_script( 'climatecontrol-js' ); // Example wp_register_script( 'climatecontrol-js', get_bloginfo('template_directory') . '/js/climatecontrol.js', array( 'jquery' ) ); wp_enqueue_script( 'climatecontrol-js' ); wp_register_style('nivoslider-css', get_bloginfo('template_directory') . '/css/nivo-slider.css'); wp_enqueue_style('nivoslider-css'); } add_action('wp_enqueue_scripts', 'basic_template_scripts'); /* Limit string by words not characters */ function limit_words($string, $word_limit) { $words = explode(" ",$string); return implode(" ",array_splice($words,0,$word_limit)); } function remove_menus () { global $menu; $restricted = array(__('Links'), __('Comments')); end ($menu); while (prev($menu)){ $value = explode(' ',$menu[key($menu)][0]); if(in_array($value[0] != NULL?$value[0]:"" , $restricted)){unset($menu[key($menu)]);} } } add_action('admin_menu', 'remove_menus'); add_action("login_head", "my_login_head"); function my_login_head() { echo " "; } add_filter( 'login_headerurl', 'w4_login_headerurl'); function w4_login_headerurl(){ return home_url('/'); } function columns_one_third( $atts, $content = null ) { return '
' . do_shortcode($content) . '
'; } add_shortcode('one_third', 'columns_one_third'); function columns_one_third_last( $atts, $content = null ) { return '
' . do_shortcode($content) . '
'; } add_shortcode('one_third_last', 'columns_one_third_last'); function columns_two_third( $atts, $content = null ) { return '
' . do_shortcode($content) . '
'; } add_shortcode('two_third', 'columns_two_third'); function columns_two_third_last( $atts, $content = null ) { return '
' . do_shortcode($content) . '
'; } add_shortcode('two_third_last', 'columns_two_third_last'); function columns_one_half( $atts, $content = null ) { return '
' . do_shortcode($content) . '
'; } add_shortcode('one_half', 'columns_one_half'); function columns_one_half_last( $atts, $content = null ) { return '
' . do_shortcode($content) . '
'; } add_shortcode('one_half_last', 'columns_one_half_last'); function columns_one_fourth( $atts, $content = null ) { return '
' . do_shortcode($content) . '
'; } add_shortcode('one_fourth', 'columns_one_fourth'); function columns_one_fourth_last( $atts, $content = null ) { return '
' . do_shortcode($content) . '
'; } add_shortcode('one_fourth_last', 'columns_one_fourth_last'); function columns_three_fourth( $atts, $content = null ) { return '
' . do_shortcode($content) . '
'; } add_shortcode('three_fourth', 'columns_three_fourth'); function columns_three_fourth_last( $atts, $content = null ) { return '
' . do_shortcode($content) . '
'; } add_shortcode('three_fourth_last', 'columns_three_fourth_last'); function columns_one_fifth( $atts, $content = null ) { return '
' . do_shortcode($content) . '
'; } add_shortcode('one_fifth', 'columns_one_fifth'); function columns_one_fifth_last( $atts, $content = null ) { return '
' . do_shortcode($content) . '
'; } add_shortcode('one_fifth_last', 'columns_one_fifth_last'); function columns_two_fifth( $atts, $content = null ) { return '
' . do_shortcode($content) . '
'; } add_shortcode('two_fifth', 'columns_two_fifth'); function columns_two_fifth_last( $atts, $content = null ) { return '
' . do_shortcode($content) . '
'; } add_shortcode('two_fifth_last', 'columns_two_fifth_last'); function columns_three_fifth( $atts, $content = null ) { return '
' . do_shortcode($content) . '
'; } add_shortcode('three_fifth', 'columns_three_fifth'); function columns_three_fifth_last( $atts, $content = null ) { return '
' . do_shortcode($content) . '
'; } add_shortcode('three_fifth_last', 'columns_three_fifth_last'); function columns_four_fifth( $atts, $content = null ) { return '
' . do_shortcode($content) . '
'; } add_shortcode('four_fifth', 'columns_four_fifth'); function columns_four_fifth_last( $atts, $content = null ) { return '
' . do_shortcode($content) . '
'; } add_shortcode('four_fifth_last', 'columns_four_fifth_last'); function columns_one_sixth( $atts, $content = null ) { return '
' . do_shortcode($content) . '
'; } add_shortcode('one_sixth', 'columns_one_sixth'); function columns_one_sixth_last( $atts, $content = null ) { return '
' . do_shortcode($content) . '
'; } add_shortcode('one_sixth_last', 'columns_one_sixth_last'); function columns_five_sixth( $atts, $content = null ) { return '
' . do_shortcode($content) . '
'; } add_shortcode('five_sixth', 'columns_five_sixth'); function columns_five_sixth_last( $atts, $content = null ) { return '
' . do_shortcode($content) . '
'; } add_shortcode('five_sixth_last', 'columns_five_sixth_last'); function columns_formatter($content) { $new_content = ''; /* Matches the contents and the open and closing tags */ $pattern_full = '{(\[raw\].*?\[/raw\])}is'; /* Matches just the contents */ $pattern_contents = '{\[raw\](.*?)\[/raw\]}is'; /* Divide content into pieces */ $pieces = preg_split($pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE); /* Loop over pieces */ foreach ($pieces as $piece) { /* Look for presence of the shortcode */ if (preg_match($pattern_contents, $piece, $matches)) { /* Append to content (no formatting) */ $new_content .= $matches[1]; } else { /* Format and append to content */ $new_content .= wptexturize(wpautop($piece)); } } return $new_content; } // Remove the 2 main auto-formatters remove_filter('the_content', 'wpautop'); remove_filter('the_content', 'wptexturize'); // Before displaying for viewing, apply this function add_filter('the_content', 'columns_formatter', 99); add_filter('widget_text', 'columns_formatter', 99); /* Pagination as found here: http://design.sparklette.net/teaches/how-to-add-wordpress-pagination-without-a-plugin/ */ function pagination($pages = '', $range = 4) { $showitems = ($range * 2)+1; global $paged; if(empty($paged)) $paged = 1; if($pages == '') { global $wp_query; $pages = $wp_query->max_num_pages; if(!$pages) { $pages = 1; } } if(1 != $pages) { echo "
Page ".$paged." of ".$pages.""; if($paged > 2 && $paged > $range+1 && $showitems < $pages) echo "« First"; if($paged > 1 && $showitems < $pages) echo "‹ Previous"; for ($i=1; $i <= $pages; $i++) { if (1 != $pages &&( !($i >= $paged+$range+1 || $i <= $paged-$range-1) || $pages <= $showitems )) { echo ($paged == $i)? "".$i."":"".$i.""; } } if ($paged < $pages && $showitems < $pages) echo "Next ›"; if ($paged < $pages-1 && $paged+$range-1 < $pages && $showitems < $pages) echo "Last »"; echo "
\n"; } }