980,
'height' => 60,
'default-image' => get_template_directory_uri() . '/images/header.jpg',
);
add_theme_support( 'custom-header',$args );
/**
* Register nav menus.
*/
register_nav_menus(
array(
'main-menu' => __( 'Main Menu', 'moustache' )
)
);
}
add_action( 'after_setup_theme', 'moustache_setup' );
}
/**
* ----------------------------------------------------------------------------------------
* 5.0 - Display meta information for a specific post.
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'moustache_post_meta' ) ) {
function moustache_post_meta() {
echo '
';
if ( get_post_type() === 'post' ) {
// If the post is sticky, mark it.
if ( is_sticky() ) {
echo '- ' . __( 'Sticky', 'moustache' ) . '
';
}
// Get the post author.
printf(
'- %2$s
',
esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ),
get_the_author()
);
// Get the date.
echo '- ' . get_the_date() . '
';
// The tags.
$tag_list = get_the_tag_list( '', ', ' );
if ( $tag_list ) {
echo '- ' . $tag_list . '
';
}
// Comments link.
if ( comments_open() ) :
echo '- ';
echo '';
comments_popup_link( __( 'Leave a comment', 'moustache' ), __( 'One comment so far', 'moustache' ), __( 'View all % comments', 'moustache' ) );
echo '';
echo '
';
endif;
echo '
';
}
}
}
/**
* ----------------------------------------------------------------------------------------
* 5.5 - Display meta information for a specific post.
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'moustache_post_catagories_edit' ) ) {
function moustache_post_catagories_edit() {
echo '';
// The categories.
$category_list = get_the_category_list( ', ' );
if ( $category_list ) {
echo '- ' . $category_list . '
';
}
// Edit link.
if ( is_user_logged_in() ) {
echo '- ';
edit_post_link( __( 'Edit', 'moustache' ), '', '' );
echo '
';
}
echo '
';
}
}
/**
* ----------------------------------------------------------------------------------------
* 6.0 - Display navigation to the next/previous set of posts.
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'moustache_paging_nav' ) ) {
function moustache_paging_nav() { ?>
__( 'Main Widget Area', 'moustache' ),
'id' => 'sidebar-1',
'description' => __( 'Appears on posts and pages.', 'moustache' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
)
);
register_sidebar(
array(
'name' => __( 'Footer Widget Area', 'moustache' ),
'id' => 'sidebar-2',
'description' => __( 'Appears on the footer.', 'moustache' ),
'before_widget' => '',
'after_widget' => '
',
'before_title' => '',
)
);
}
}
add_action( 'widgets_init', 'moustache_widget_init' );
}
/**
* ----------------------------------------------------------------------------------------
* 8.0 - Function that validates a field's length.
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'moustache_validate_length' ) ) {
function moustache_validate_length( $fieldValue, $minLength ) {
// First, remove trailing and leading whitespace
return ( strlen( trim( $fieldValue ) ) > $minLength );
}
}
/**
* ----------------------------------------------------------------------------------------
* 10.0 - Load the custom scripts for the theme.
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( 'moustache_scripts' ) ) {
function moustache_scripts() {
// Adds support for pages with threaded comments
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
wp_enqueue_script('bootstrap-js', MOUSTACHE_THEMEROOT. '/js/bootstrap.min.js', array( 'jquery' ), '');
wp_enqueue_script('custom-scripts', MOUSTACHE_THEMEROOT. '/js/scripts.js', array( 'jquery' ), '');
wp_enqueue_script('fit-vids', MOUSTACHE_THEMEROOT. '/js/jquery.fitvids.js', array( 'jquery' ), '');
wp_enqueue_style( 'moustache-master', MOUSTACHE_THEMEROOT . '/css/bootstrap.min.css');
wp_enqueue_style( 'moustache-custom-css', MOUSTACHE_THEMEROOT . '/css/custom.css' );
wp_enqueue_style( 'components-css', MOUSTACHE_THEMEROOT . '/css/components.css' );
wp_enqueue_style( 'moustache-style',get_stylesheet_uri(),array() );
}
add_action( 'wp_enqueue_scripts', 'moustache_scripts' );
}
/**
* ----------------------------------------------------------------------------------------
* 11.0 - Filter Wp Title
* ----------------------------------------------------------------------------------------
*/
add_theme_support( 'title-tag' );
/**
* ----------------------------------------------------------------------------------------
* 12.0 - Fallback Wordpress Navigation Menus.
* ----------------------------------------------------------------------------------------
*/
/**
** A fallback when no navigation is selected by default, otherwise it throws some nasty errors in your face.
**/
function moustache_fallback_message(){
echo '';
// Translators 1: Link to Menus, 2: Link to Customize
printf( __( 'Please assign a menu to the primary menu location under %1$s or select the menu from the general option setting page.', 'requiredfoundation' ),
sprintf( __( '
Menus', 'moustache' ),
get_admin_url( get_current_blog_id(), 'nav-menus.php' )
),
sprintf( __( '
Customize', 'moustache' ),
get_admin_url( get_current_blog_id(), 'customize.php' )
)
);
echo '
';
}
/**
* ----------------------------------------------------------------------------------------
* 13.0 - Add Editor Styles
* ----------------------------------------------------------------------------------------
*/
function moustache_add_editor_styles() {
add_editor_style( 'custom-editor-style.css' );
}
add_action( 'admin_init', 'moustache_add_editor_styles' );
/**
* ----------------------------------------------------------------------------------------
* 14.0 - Load the framework.
* ----------------------------------------------------------------------------------------
*/
if ( ! function_exists( '_wp_render_title_tag' ) ) {
function moustache_render_title() {
?>