'.single_cat_title( '', false ) . '' ); ?>
' . $category_description . '';
?>
' . single_tag_title( '', false ) . '' ); ?>
' . get_the_author_meta( 'display_name', get_query_var( 'author' ) ) . '' ); ?>
' . get_search_query() . '' ); ?>
' . get_the_date() . '' ); ?>
' . get_the_date( 'F Y' ) . '' ); ?>
' . get_the_date( 'Y' ) . '' ); ?>
ID, '_wp_page_template', true ) == 'template-fullwidth.php' ) {
echo 'sidebar-none';
} elseif( !empty( $nest_options['sidebar_pos'] ) ) {
if( $nest_options['sidebar_pos'] == 'right' ) {
echo 'sidebar-right';
} elseif( $nest_options['sidebar_pos'] == 'left' ) {
echo 'sidebar-left';
} elseif( $nest_options['sidebar_pos'] == 'none' ) {
echo 'sidebar-none';
}
} else {
if( $nest_options_default_data['sidebar_pos'] == 'right' ) {
echo 'sidebar-right';
} elseif( $nest_options_default_data['sidebar_pos'] == 'left' ) {
echo 'sidebar-left';
} elseif( $nest_options_default_data['sidebar_pos'] == 'none' ) {
echo 'sidebar-none';
}
}
} // nest_part_structure_class();
/* ========== Theme options ========== */
$nest_options_items = array (
array(
'id' => 'sidebar_pos',
'name' => __( 'Sidebar Position', 'nest' ),
'type' => 'select',
'data' => array( array( 'name' => __( 'On the left', 'nest' ), 'value' => 'left' ), array( 'name' => __( 'On the right', 'nest' ), 'value' => 'right' ), array( 'name' => __( 'Hide sidebar (wide column)', 'nest' ), 'value' => 'none' ) ),
'desc' => __( 'Select where your sidebar will be.', 'nest' )
),
array(
'id' => 'logo_url',
'name' => __( 'Logo URL', 'nest' ),
'type' => 'text',
'desc' => __( 'Put your website logo URL here. (leave it blank for displaying site name and site description.)', 'nest' )
),
array(
'id' => 'menu_effect',
'name' => __( 'Multi-level Menu Effect', 'nest' ),
'type' => 'select',
'data' => array( array( 'name' => __( 'None', 'nest' ), 'value' => 'none' ), array( 'name' => __( 'Fade', 'nest' ), 'value' => 'fade' ), array( 'name' => __( 'Flexible', 'nest' ), 'value' => 'flexible' ) ),
'desc' => __( 'Select the effect of multi-level navigation menu.', 'nest' )
),
array(
'id' => 'is_display_author_info',
'name' => __( 'Author Info', 'nest' ),
'type' => 'checkbox',
'data' => __( 'Display Author Info', 'nest' ),
'desc' => __( 'Enabling this will display your author information in a single post page. (avatars visibility required)', 'nest' )
),
array(
'id' => 'is_display_by-nc-sa',
'name' => __( 'BY-NC-SA License Notice', 'nest' ),
'type' => 'checkbox',
'data' => __( 'Display BY-NC-SA License Notice', 'nest' ),
'desc' => __( 'Enabling this will display the BY-NC-SA License Notice in a singular page.', 'nest' )
),
array(
'id' => 'is_display_random_posts_widget',
'name' => __( 'Random Posts Widget', 'nest' ),
'type' => 'checkbox',
'data' => __( 'Display random posts widget', 'nest' ),
'desc' => __( 'Enabling this will display the random posts widget in the sidebar of homepage.', 'nest' )
),
array(
'id' => 'is_display_post_meta_in_page',
'name' => __( 'Post meta in pages', 'nest' ),
'type' => 'checkbox',
'data' => __( 'Display post meta-information in pages', 'nest' ),
'desc' => __( 'Enabling this will display the post meta-information under the post title in pages.', 'nest' )
),
array(
'id' => 'is_display_posts_navi_links_in_single',
'name' => __( 'Posts navigation links in single posts', 'nest' ),
'type' => 'checkbox',
'data' => __( 'Display posts navigation in single posts', 'nest' ),
'desc' => __( 'Enabling this will display the posts navigation links (previous and next post) in a single post.', 'nest' )
),
array(
'id' => 'is_display_header_menu_arrow',
'name' => __( 'Header parent menu arrow mark ', 'nest' ),
'type' => 'checkbox',
'data' => __( 'Display the arrow mark of parent menu items', 'nest' ),
'desc' => __( 'Enabling this will display the arrow mark of parent menu items containing sub-menu.', 'nest' )
),
array(
'id' => 'rss_url',
'name' => __( 'RSS URL', 'nest' ),
'type' => 'text',
'desc' => __( 'Put your full RSS subscribe URL here. (with http://, leave it blank for displaying the standard URL.)', 'nest' )
),
array(
'id' => 'twitter_url',
'name' => __( 'Twitter URL', 'nest' ),
'type' => 'text',
'desc' => __( 'Put your full Twitter URL here. (with http://, leave it blank for displaying none.)', 'nest' )
),
array(
'id' => 'facebook_url',
'name' => __( 'Facebook URL', 'nest' ),
'type' => 'text',
'desc' => __( 'Put your full Facebook URL here. (with http://, leave it blank for displaying none.)', 'nest' )
),
array(
'id' => 'sina_url',
'name' => __( 'Sina WeiBo URL', 'nest' ),
'type' => 'text',
'desc' => __( 'Put your full Sina WeiBo URL here. (with http://, leave it blank for displaying none.)', 'nest' )
),
array(
'id' => 'code_siteinfo',
'name' => __( 'Custom Website Info String', 'nest' ),
'type' => 'textarea',
'desc' => __( 'Some HTML code replaced the footer\'s website information.', 'nest' )
)
);
// default values of theme options
$nest_options_default_data = array(
'sidebar_pos' => 'right',
'menu_effect' => 'fade',
'is_display_author_info' => '0',
'is_display_by-nc-sa' => '1',
'is_display_post_meta_in_page' => '0',
'is_display_posts_navi_links_in_single' => '1',
'is_display_header_menu_arrow' => '1'
);
add_action( 'admin_init', 'nest_options_init' );
add_action( 'admin_menu', 'nest_options_add_page' );
add_action( 'init', 'nest_options_default' );
function nest_options_init(){
register_setting( 'nest_theme_options', 'nest_theme_options', 'nest_options_validate' );
}
function nest_options_add_page() {
add_theme_page( __( 'Theme Options', 'nest' ), __( 'Theme Options', 'nest' ), 'edit_theme_options', 'theme_options', 'nest_options_do_page' );
}
function nest_options_validate( $input ) {
global $nest_options_items;
foreach ( $nest_options_items as $item ) {
switch ( $item['type'] ) {
case 'text':
$input[$item['id']] = wp_filter_nohtml_kses( $input[$item['id']] );
break;
case 'textarea':
$input[$item['id']] = htmlspecialchars( $input[$item['id']] );
break;
case 'checkbox':
$input[$item['id']] = ( $input[$item['id']] == 1 ? 1 : 0 );
break;
}
}
return $input;
}
function nest_options_default() {
global $nest_options_items, $nest_options_default_data;
$nest_options = get_option( 'nest_theme_options' );
foreach ( $nest_options_items as $item ) {
if ( ! isset( $nest_options[$item['id']] ) ) {
if ( isset ( $nest_options_default_data[$item['id']] ) ) {
$nest_options[$item['id']] = $nest_options_default_data[$item['id']];
} else {
$nest_options[$item['id']] = '';
}
}
}
update_option( 'nest_theme_options', $nest_options );
}
// display admin theme options page
function nest_options_do_page() {
global $nest_options_items;
if ( ! isset( $_GET['settings-updated'] ) ) $_GET['settings-updated'] = false;
?>
" . get_current_theme() . ' ' . __( 'Theme Options', 'nest' ) . ""; ?>
__( 'Primary Widget Area', 'nest' ),
'id' => 'primary-widget-area',
'description' => __( 'The primary widget area', 'nest' ),
'before_widget' => '',
'after_widget' => '',
'before_title' => '',
) );
}
}
add_action( 'widgets_init', 'nest_widgets_init' );
/* ========== Theme Setup ========== */
function nest_theme_setup() {
add_theme_support( 'post-thumbnails' );
add_theme_support( 'automatic-feed-links' );
register_nav_menus( array( 'primary' => __( 'Primary Navigation', 'nest' ) ) );
}
add_action( 'after_setup_theme', 'nest_theme_setup' );
function nest_init_scripts() {
global $nest_options;
wp_enqueue_script( 'jquery' );
if( $nest_options['is_display_header_menu_arrow'] ) {
wp_register_script( 'nest-menu-arrow', get_template_directory_uri() . '/scripts/nest-menu-arrow.js', array( 'jquery' ) );
wp_enqueue_script( 'nest-menu-arrow' );
}
switch( $nest_options['menu_effect'] ) {
case 'fade':
wp_register_script( 'nest-menu-effect-fade', get_template_directory_uri() . '/scripts/nest-menu-effect-fade.js', array( 'jquery' ) );
wp_enqueue_script( 'nest-menu-effect-fade' );
break;
case 'flexible':
wp_register_script( 'nest-menu-effect-flexible', get_template_directory_uri() . '/scripts/nest-menu-effect-flexible.js', array( 'jquery' ) );
wp_enqueue_script( 'nest-menu-effect-flexible' );
break;
default:
wp_register_script( 'nest-menu-effect-none', get_template_directory_uri() . '/scripts/nest-menu-effect-none.js', array( 'jquery' ) );
wp_enqueue_script( 'nest-menu-effect-none' );
break;
}
}
add_action('wp_enqueue_scripts', 'nest_init_scripts');
// set variable $content_width ( WP required )
if( $nest_options['sidebar_pos'] == 'none' ) {
$content_width = 930;
} else {
$content_width = 630;
}
// define post thumbnail image HTML
function nest_the_thumbnail() {
global $post;
$id = (int) $post->ID;
if ( ! $id ) return false;
$html = get_the_post_thumbnail( $id, array(180, 180) );
if( ! empty( $html ) ){
echo '';
}
}
// redefine search form code ( HTML validation required )
function nest_my_search_form( $form ) {
$form = '';
return $form;
}
add_filter( 'get_search_form', 'nest_my_search_form' );
add_filter( 'use_default_gallery_style', '__return_false' );
?>