__( 'Primary Menu', 'squoze' ),
) );
register_nav_menus( array(
'secondary' => __( 'Secondary Menu', 'squoze' ),
) );
}
endif; // squoze_setup
add_action( 'after_setup_theme', 'squoze_setup' );
/**
* Register widgetized area and update sidebar with default widgets
*
* @since squoze 1.0
*/
function squoze_widgets_init() {
register_widget( 'Squoze_About_Widget' );
register_sidebar( array(
'name' => __( 'Sidebar One', 'squoze' ),
'id' => 'sidebar-1',
'before_widget' => '",
'before_title' => '
',
) );
register_sidebar( array(
'name' => __( 'Sidebar Two', 'squoze' ),
'id' => 'sidebar-2',
'description' => __( 'An optional second sidebar widget area', 'squoze' ),
'before_widget' => '",
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Area One', 'squoze' ),
'id' => 'sidebar-3',
'description' => __( 'An optional widget area for your site footer', 'squoze' ),
'before_widget' => '",
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Area Two', 'squoze' ),
'id' => 'sidebar-4',
'description' => __( 'An optional widget area for your site footer', 'squoze' ),
'before_widget' => '",
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Area Three', 'squoze' ),
'id' => 'sidebar-5',
'description' => __( 'An optional widget area for your site footer', 'squoze' ),
'before_widget' => '",
'before_title' => '',
) );
register_sidebar( array(
'name' => __( 'Footer Area Four', 'squoze' ),
'id' => 'sidebar-6',
'description' => __( 'An optional widget area for your site footer', 'squoze' ),
'before_widget' => '",
'before_title' => '',
) );
}
add_action( 'widgets_init', 'squoze_widgets_init' );
/**
* Get layout and sidebar info
*/
function squoze_get_layout() {
// Get layout and column spans
switch ( of_get_option( 'sidebar_layout' ) ) {
case 'both':
get_sidebar( 'two' );
$leftside = of_get_option( 'left_sidebar_columns', 3 );
$rightside = of_get_option( 'right_sidebar_columns', 3 );
$content_columns = 12 - $leftside - $rightside;
wp_localize_script(
'squoze-js',
'layout_object',
array(
'layout' => 'both',
)
);
break;
case 'left':
$leftside = of_get_option( 'left_sidebar_columns' );
$content_columns = 12 - $leftside;
$content_columns .= " float_right";
break;
case 'right':
$rightside = of_get_option( 'right_sidebar_columns' );
$content_columns = 12 - $rightside;
break;
default:
$content_columns = 12;
break;
}
return $content_columns;
}
function squoze_which_sidebars() {
switch ( of_get_option( 'sidebar_layout' ) ) {
case 'both':
get_sidebar();
break;
case 'left':
case 'right':
get_sidebar();
get_sidebar( 'two' );
break;
default:
break;
}
}
/**
* Enqueue scripts and styles
*/
function squoze_scripts() {
global $post;
wp_enqueue_style( 'style', get_stylesheet_uri() );
if( $custom_styles = of_get_option( 'custom_styles' ) ) {
wp_enqueue_style( 'squoze-custom-css', $custom_styles );
}
wp_enqueue_script( 'respond', get_template_directory_uri() . '/js/respond.min.js', false, '1.1.0' );
wp_enqueue_script( 'squoze-js', get_template_directory_uri() . '/js/squoze.js', array( 'jquery' ), '20120206', true );
if ( is_singular() && wp_attachment_is_image( $post->ID ) ) {
wp_enqueue_script( 'keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' );
}
}
add_action( 'wp_enqueue_scripts', 'squoze_scripts' );
function theme_slug_enqueue_comment_reply_script() {
if ( comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
}
add_action( 'comment_form_before', 'theme_slug_enqueue_comment_reply_script' );
/**
* Implement the View feature
*/
function squoze_get_view($template, $args, $content = null) {
$filename = get_template_directory() . '/views/' . $template;
ob_start();
include $filename;
$view = ob_get_contents();
ob_end_clean();
return $view;
}
/**
* Where the post has no post title, but must still display a link to the single-page post view.
* Nicked from Emil Uzelac's Responsive theme
*/
add_filter('the_title', 'squoze_title');
function squoze_title($title) {
if ($title == '') {
return __('Untitled','squoze');
} else {
return $title;
}
}
/**
* Remove annoying, dangerous stuff
*/
function squoze_remove_version() {
return '';
}
add_filter( 'the_generator', 'squoze_remove_version' );
remove_action( 'wp_head', 'wlwmanifest_link');