* @copyright Copyright (c) 2013-2014, Arthur Gareginyan
* @link http://mycyberuniverse.tk/anarcho-notepad.html
* @license http://www.gnu.org/licenses/gpl-3.0.html
*/
// Ladies, Gentalmen, boys and girls let's start our engine
add_action('after_setup_theme', 'anarcho_notepad_setup');
function anarcho_notepad_setup() {
global $content_width;
// Localization Init
load_theme_textdomain( 'anarcho-notepad', get_template_directory() . '/languages' );
// This feature enables Custom Backgrounds.
add_theme_support( 'custom-background', array(
'default-image' => get_template_directory_uri() . '/images/background.jpg', ) );
// This feature enables Custom Header.
add_theme_support( 'custom-header', array(
'flex-width' => true,
'width' => 500,
'flex-height' => true,
'height' => 150,
//'default-text-color' => '#e5e5e5',
'header-text' => true,
//'default-image' => get_template_directory_uri() . '/images/logotype.jpg',
'uploads' => true,
) );
// This feature enables Featured Images (also known as post thumbnails).
add_theme_support('post-thumbnails');
set_post_thumbnail_size(540,230,!1);
// This feature enables post and comment RSS feed links to
.
add_theme_support('automatic-feed-links');
// Add HTML5 elements
add_theme_support( 'html5', array( 'comment-list', 'search-form', 'comment-form', ) );
// This feature enables menu.
register_nav_menus( array(
'primary' => __( 'Primary', 'anarcho-notepad' ) ));
// This feature enables Link Manager in Admin page.
add_filter( 'pre_option_link_manager_enabled', '__return_true' );
// Add Callback for Custom TinyMCE editor stylesheets. (editor-style.css)
add_editor_style();
}
// Redirect to the theme options page after theme is activated
if ( is_admin() && isset($_GET['activated'] ) && $pagenow == "themes.php" )
wp_redirect(admin_url( 'customize.php?' ));
// Add Theme Information Page.
require get_template_directory() . '/inc/theme_info.php';
// Add Theme Customizer functionality.
require get_template_directory() . '/inc/customizer.php';
// Add IE conditional HTML5 shim to header
function anarcho_add_ie_html5_shim () {
global $is_IE;
if ($is_IE)
echo '';
}
add_action('wp_head', 'anarcho_add_ie_html5_shim');
// This feature enables sidebar.
function anarcho_widgets_init() {
register_sidebar(array(
'name' => __('Sidebar Area 1', 'anarcho-notepad'),
'id' => 'sidebar-1',
'description' => __('Widgets in this area will be shown below "Pages".', 'anarcho-notepad'),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
register_sidebar(array(
'name' => __('Sidebar Area 2', 'anarcho-notepad'),
'id' => 'sidebar-2',
'description' => __('Widgets in this area will be shown below "What is this place".', 'anarcho-notepad'),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
register_sidebar(array(
'name' => __('Sidebar Area 3', 'anarcho-notepad'),
'id' => 'sidebar-3',
'description' => __('Widgets in this area will be shown below "Frends & Links".', 'anarcho-notepad'),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
register_sidebar(array(
'name' => __('Sidebar Area 4', 'anarcho-notepad'),
'id' => 'sidebar-4',
'description' => __('Widgets in this area will be shown below "Recent Posts".', 'anarcho-notepad'),
'before_widget' => '',
'before_title' => '
',
'after_title' => '
',
));
}
add_action( 'widgets_init', 'anarcho_widgets_init' );
// Adds a custom default avatar
function anarcho_avatar( $avatar_defaults ) {
$myavatar = get_stylesheet_directory_uri() . '/images/anarchy-symbol.png';
$avatar_defaults[$myavatar] = 'Anarcho symbol';
return $avatar_defaults;
}
add_filter( 'avatar_defaults', 'anarcho_avatar' );
// Enable comment_reply
function anarcho_include_comment_reply() {
if ( is_singular() ) wp_enqueue_script( "comment-reply" );
}
add_action( 'wp_enqueue_scripts', 'anarcho_include_comment_reply' );
// Include Font-Awesome styles
function anarcho_include_font_awesome_styles() {
wp_register_style( 'font_awesome_styles', get_template_directory_uri() . '/fonts/font-awesome-4.0.0/font-awesome.min.css', 'screen' );
wp_enqueue_style( 'font_awesome_styles' );
}
add_action( 'wp_enqueue_scripts', 'anarcho_include_font_awesome_styles' );
// Enable smoothscroll.js
function include_smoothscroll_script() {
wp_enqueue_script( 'back-top', get_template_directory_uri() . '/js/smoothscroll.js', array( 'jquery' ), '', true );
}
add_action( 'wp_enqueue_scripts', 'include_smoothscroll_script' );
// Enable Breadcrumbs
function anarcho_breadcrumbs() {
if(get_theme_mod('enable_breadcrumbs') == '1') {
$delimiter = '»';
$before = '';
$after = '';
echo '';
}
}
// END-Breadcrumbs
// Page Navigation
/* Display navigation to next/previous set of posts when applicable. */
function anarcho_page_nav() {
if(get_theme_mod('enable_page-nav') == '1') {
global $wp_query, $wp_rewrite;
$pages = '';
$max = $wp_query->max_num_pages;
if (!$current = get_query_var('paged')) $current = 1;
$a['base'] = str_replace(999999999, '%#%', get_pagenum_link(999999999));
$a['total'] = $max;
$a['current'] = $current;
$total = 0;
$a['mid_size'] = 3;
$a['end_size'] = 1;
$a['prev_text'] = __('Previous page', 'anarcho-notepad');
$a['next_text'] = __('Next page', 'anarcho-notepad');
if ($max > 0) echo ' ';
}
else {
global $wp_query;
// Don't print empty markup if there's only one page.
if ( $wp_query->max_num_pages < 2 )
return;
?>
post_parent ) : get_adjacent_post( false, '', true );
$next = get_adjacent_post( false, '', false );
if ( ! $next && ! $previous )
return;
?>
comment_type ) :
case 'pingback' :
case 'trackback' :
// Display trackbacks differently than normal comments.
?>
id="comment-">
', '' ); ?>
id="li-comment-">
%1$s %2$s',
get_comment_author_link(),
// If current post author is also comment author, make it known visually.
( $comment->user_id === $post->post_author ) ? '' . __( 'Post author', 'anarcho-notepad' ) . '' : ''
);
printf( '',
esc_url( get_comment_link( $comment->comment_ID ) ),
get_comment_time( 'c' ),
/* translators: 1: date, 2: time */
sprintf( '%1$s at %2$s', get_comment_date(), get_comment_time() )
);
?>
comment_approved ) : ?>
', '' ); ?>