'; }else { $output = ''; } echo $output; } add_action('wp_head', 'mmtheme_get_favicon'); } // OpenGraph SEO integration in Header Meta. if ( '1' === get_theme_mod( 'og_on_off' ) ) { get_template_part('og_seo_integration'); } else { } // Canonical SEO urls to avoid duplication of content add_action( 'wp_head', 'rel_canonical' ); // Default SEO title add_filter( 'wp_title', 'm3_wp_title_for_home' ); function m3_wp_title_for_home( $title ) { if( empty( $title ) && ( is_home() || is_front_page() ) ) { return __( 'Home', 'theme_domain' ) . ' | ' . get_bloginfo( 'description' ); } return $title; } //Some simple code for our widget-enabled sidebar if ( function_exists('register_sidebar') ) { register_sidebar(array( 'id' => 'default-sidebar', 'name' => __('Default Sidebar','mm'), 'description' => __( 'Main sidebar that appears on the right.', 'mm' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar(array( 'id' => 'footer-sidebar-1', 'name' => __('Footer Block 1','mm'), 'description' => __( 'Main sidebar that appears in the footer.', 'mm' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar(array( 'id' => 'footer-sidebar-2', 'name' => __('Footer Block 2','mm'), 'description' => __( 'Main sidebar that appears in the footer.', 'mm' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar(array( 'id' => 'footer-sidebar-3', 'name' => __('Footer Block 3','mm'), 'description' => __( 'Main sidebar that appears in the footer.', 'mm' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); } //Add support for WordPress 3.0's custom menus add_action( 'init', 'register_my_menu' ); //Register area for custom menu function register_my_menu() { /* Navigation menu code */ register_nav_menus( array( 'primary' => __( 'Primary Navigation', 'mm' ), ) ); } //Code for custom background support add_theme_support('custom-background'); //Enable post and comments RSS feed links to head add_theme_support( 'automatic-feed-links' ); /* THUMBNAIL */ if( function_exists( 'add_theme_support' ) ) { add_theme_support( 'post-thumbnails' ); add_image_size( 'blogthumbnail', 150, 150, true ); add_image_size( 'popular-thumb', 84, 55, true ); add_image_size( 'sidebar-thumb', 50, 50, true ); } /* End Thumbnail */ /* Google rich snippets Breadcrumbs for better SEO */ function m3_seo_breadcrumbs() { /* === OPTIONS === */ $text['home'] = 'Home'; // text for the 'Home' link $text['category'] = 'Archive by Category "%s"'; // text for a category page $text['search'] = 'Search Results for "%s" Query'; // text for a search results page $text['tag'] = 'Posts Tagged "%s"'; // text for a tag page $text['author'] = 'Articles Posted by %s'; // text for an author page $text['404'] = 'Error 404'; // text for the 404 page $show_current = 1; // 1 - show current post/page/category title in breadcrumbs, 0 - don't show $show_on_home = 0; // 1 - show breadcrumbs on the homepage, 0 - don't show $show_home_link = 1; // 1 - show the 'Home' link, 0 - don't show $show_title = 1; // 1 - show the title for the links, 0 - don't show $delimiter = ' » '; // delimiter between crumbs $before = ''; // tag before the current crumb $after = ''; // tag after the current crumb /* === END OF OPTIONS === */ global $post; $home_link = home_url('/'); $link_before = ''; $link_after = ''; $link_attr = ' rel="v:url" property="v:title"'; $link = $link_before . '%2$s' . $link_after; $parent_id = $parent_id_2 = $post->post_parent; $frontpage_id = get_option('page_on_front'); if (is_home() || is_front_page()) { if ($show_on_home == 1) echo ''; } else { echo ''; } } // end m3_seo_breadcrumbs() /* Pagination */ if ( ! function_exists( 'my_pagination' ) ) : function my_pagination() { global $wp_query; $big = 999999999; // need an unlikely integer echo paginate_links( array( 'base' => str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) ), 'format' => '?paged=%#%', 'current' => max( 1, get_query_var('paged') ), 'total' => $wp_query->max_num_pages ) ); } endif; // Content Limit function the_content_limit($max_char, $more_link_text = ' ', $stripteaser = 0, $more_file = '') { $content = get_the_content($more_link_text, $stripteaser, $more_file); $content = apply_filters('the_content', $content); $content = str_replace(']]>', ']]>', $content); $content = strip_tags($content); if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) { $content = substr($content, 0, $espacio); $content = $content; echo "

"; echo $content; echo "...".""; echo "

"; } else { echo "

"; echo $content; echo "...".""; echo "

"; } } /* Strip Shortcode from Excerpt */ function remove_shortcode_from_index($content) { if ( is_home() || is_archive() || is_search() ) { $content = strip_shortcodes( $content ); } return $content; } add_filter('the_content', 'remove_shortcode_from_index'); /* JS */ require( get_template_directory() . '/includes/theme-js.php' ); // Theme Customizer require( get_template_directory() . '/includes/customizer.php' ); require( get_template_directory() . '/includes/customizer-css.php' ); // adding a class for layout option. function add_layout_class( $classes ) { if ( '2' === get_theme_mod( 'sidebar_switch' ) ) { array_push( $classes, 'sidebar-left' ); } // end if return $classes; } add_filter('body_class', 'add_layout_class'); // Theme Customizer style script function customizer_style_init() { wp_enqueue_style( 'style-name', get_template_directory_uri() . '/includes/admin.css'); } add_action( 'customize_controls_enqueue_scripts', 'customizer_style_init' ); ?>