get( 'Version' ) ); spacexchimp_t001_define_constants( 'PREFIX', 'spacexchimp_t001' ); /* Ladies and Gentlemans, boys and girls let's start our engine */ function anarcho_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.png' )); // 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.png', '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', 'gallery', 'caption', ) ); // Add Title-tag add_theme_support('title-tag'); // 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_action( 'after_setup_theme', 'anarcho_setup' ); /** * Upgrade DB settings * * @since 2.31 */ function anarcho_upgrade_settings() { // Read saved theme settings $settings_saved = get_option( 'theme_mods_anarcho-notepad' ); // Return if the upgrade has already been made if ( isset($settings_saved['upgraded']) && $settings_saved['upgraded'] == 'yes' ) { return; } // Make array with default values $settings_default = array( 'enable_year_ribbons' => '', 'disable_ribbons' => '', 'enable_title_animation' => '', 'disable_paper_search' => '', 'disable_about_box' => '', 'disable_links_box' => '', 'disable_stickers' => '', 'disable_recent_sticker' => '', 'enable_breadcrumbs' => '', 'enable_page-nav' => '', 'disable_about_bio' => '', 'disable_scroll_to_top' => '', 'show_info_line' => '', 'disable_rss_icon' => '', 'num_recent_post' => '6', 'upgraded' => 'yes' ); if ( !empty( $settings_saved ) ) { // Merge array of saved settings with array of new default settings $settings = array_merge( $settings_default, $settings_saved ); } else { $settings = $settings_default; } // Save new setting with default values update_option( 'theme_mods_anarcho-notepad', $settings ); } anarcho_upgrade_settings(); //Adding backwards compatibility for title-tag less than WordPress version 4.1 if ( ! function_exists( '_wp_render_title_tag' ) ) { function anarcho_render_title() { ?> <?php wp_title( '|', true, 'right' ); ?> add_menu( array( 'parent' => 'top-secondary', // Off on the right side 'id' => 'anarcho-help' , 'title' => __( 'Help' , 'anarcho-notepad' ), 'href' => admin_url( 'themes.php?page=theme_options' ), 'meta' => array( 'title' => __( 'Need help with Anarcho-Notepad? Click here!', 'anarcho-notepad' ) ) )); } } add_action ( 'wp_before_admin_bar_render', 'anarcho_add_help_button' ); /* Add the Upgrade notice */ require get_template_directory() . '/inc/upgrade_notice.php'; /* Add IE conditional HTML5 shim to header */ function anarcho_add_ie_html5_shiv () { global $is_IE; if ( $is_IE ) echo ''; } add_action( 'wp_head', 'anarcho_add_ie_html5_shiv' ); /** * Enqueue scripts and styles on the admin pages. */ function anarcho_scripts_admin() { // Load additional stylesheet for admin screens wp_enqueue_style( 'anarcho-admin-css', get_template_directory_uri() . '/inc/admin.css', array(), SPACEXCHIMP_T001_VERSION, 'all' ); } add_action( 'admin_enqueue_scripts', 'anarcho_scripts_admin' ); /** * Enqueue scripts and styles on the front end. */ function anarcho_scripts_frontend() { // Load JQuery library wp_enqueue_script( 'jquery' ); // Load the Font-Awesome iconic font wp_enqueue_style( 'anarcho-font-awesome-css', get_template_directory_uri() . '/fonts/font-awesome/css/font-awesome.css', array(), SPACEXCHIMP_T001_VERSION, 'screen' ); // Comments. Enable comment_reply if ( is_singular() ) wp_enqueue_script( "comment-reply" ); // Scroll to Top Button. Load the smoothscroll.js wp_enqueue_script( 'anarcho-smooth-scroll-js', get_template_directory_uri() . '/js/smoothscroll.js', array( 'jquery' ), SPACEXCHIMP_T001_VERSION, true ); } add_action( 'wp_enqueue_scripts', 'anarcho_scripts_frontend' ); /* Add Theme Customizer functionality */ require get_template_directory() . '/inc/customizer-arrays.php'; require get_template_directory() . '/inc/customizer.php'; /* This feature enables widgets area in the 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 "Friends & 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' ); /* This feature enables widgets area in the footer */ function anarcho_widgets_footer_init() { register_sidebar(array( 'name' => __( 'Footer Area 1', 'anarcho-notepad' ), 'id' => 'footer-1', 'description' => __( 'Widgets in this area will be shown left.', 'anarcho-notepad' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'name' => __( 'Footer Area 2', 'anarcho-notepad' ), 'id' => 'footer-2', 'description' => __( 'Widgets in this area will be shown center.', 'anarcho-notepad' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'name' => __( 'Footer Area 3', 'anarcho-notepad' ), 'id' => 'footer-3', 'description' => __( 'Widgets in this area will be shown right.', 'anarcho-notepad' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', )); } add_action( 'widgets_init', 'anarcho_widgets_footer_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' ); /* Display block "About the Author" */ function anarcho_author_bio() { if ( get_theme_mod('disable_about_bio') !== '1' ) { if ( ( get_the_author_meta( 'description' ) != '' ) ) { echo esc_html( get_template_part( 'author-bio' ) ); } } } /* Date Tag (Red ribbon) */ function anarcho_date_tag() { if ( get_theme_mod('disable_ribbons') !== '1' ) { if ( get_theme_mod('enable_year_ribbons') !== '1' ) { if ( is_home() || is_category() || is_archive() || is_search() ) { printf( '', esc_url( get_permalink() ) ); } printf( '
%1$s %2$s
', esc_attr( get_the_date('F') ), esc_attr( get_the_date('j') ) ); if ( is_home() || is_category() || is_archive() || is_search() ) { printf( '
' ); } } else { if ( is_home() || is_category() || is_archive() || is_search() ) { printf( '', esc_url( get_permalink() ) ); } printf( '
%1$s %2$s
', esc_attr( get_the_date('F j') ), esc_attr( get_the_date('Y') ) ); if ( is_home() || is_category() || is_archive() || is_search() ) { printf( '
' ); } } } } /* Enable Breadcrumbs */ function anarcho_breadcrumbs() { if ( get_theme_mod('enable_breadcrumbs') == '1' ) { $delimiter = '»'; $before = ''; $after = ''; echo ''; } } /* * 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-">
    By %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( ' on ', esc_url( get_comment_link( $comment->comment_ID ) ), get_comment_time( 'c' ), sprintf( '%1$s', get_comment_date( 'j F, Y' ) ) ); ?>
    comment_approved ) : ?>

    ', '

    ' ); ?>
    __( 'Reply', 'anarcho-notepad' ), 'after' => ' ', 'depth' => $depth, 'max_depth' => $args['max_depth'] ) ) ); ?>
    "; $anarcho_copy_theme_uri = "https://www.spacexchimp.com/themes/anarcho-notepad.html"; $anarcho_copy_theme_name = "Anarcho Notepad"; $anarcho_copy_theme_link = '' . $anarcho_copy_theme_name . ''; $anarcho_copy_author_uri = "https://www.spacexchimp.com/"; $anarcho_copy_author_name = "Space X-Chimp"; $anarcho_copy_author_link = '' . $anarcho_copy_author_name . ''; echo '
    ' . 'WordPress theme "' . $anarcho_copy_theme_link . '" by ' . $anarcho_copy_author_link . '.' . '
    '; } add_action( 'wp_footer','anarcho_copyright', 999 ); /* * Queries * Display info about a database queries */ function anarcho_mysql_queries() { if ( get_theme_mod('show_info_line') == '1' ) { echo "\n"; echo get_num_queries(); _e( ' queries in ', 'anarcho-notepad' ); timer_stop(1); _e( ' seconds', 'anarcho-notepad' ); echo ' / '; echo round(memory_get_usage()/1024/1024, 2); _e( ' mb', 'anarcho-notepad' ); echo "\n"; } } add_action( 'wp_footer','anarcho_mysql_queries', 999 ); /* * Scroll to Top Button * Load smoothscroll.js and Enable Scroll to Top Button */ function anarcho_scroll_to_top() { if ( get_theme_mod('disable_scroll_to_top') !== '1' ) { echo ' '; } } add_action( 'wp_footer','anarcho_scroll_to_top', 999 ); /* * No Content * The Message if no content */ function anarcho_not_found() { ?>

    ', '' ); } elseif ( is_single() ) { _e( 'Posted ', 'anarcho-notepad' ); the_date( get_option( 'm.d.Y' ) ); _e( ' by ', 'anarcho-notepad' ); the_author(); _e( ' in category "', 'anarcho-notepad' ); the_category( '", "' ); edit_post_link( __( 'EDIT', 'anarcho-notepad' ), '" | ', '' ); ?>
    | ', '' ); } else { ?> | ', '' ); } ?>