esc_html__( 'Main Menu', 'pirate-rogue'), 'social' => esc_html__( 'Social Icons', 'pirate-rogue'), 'social-front' => esc_html__( 'Social Icons (in About section)', 'pirate-rogue'), 'social-footer' => esc_html__( 'Social Icons (in Footer)', 'pirate-rogue'), 'footer-one' => esc_html__( 'Footer 1', 'pirate-rogue'), 'footer-two' => esc_html__( 'Footer 2', 'pirate-rogue'), 'footer-three' => esc_html__( 'Footer 3', 'pirate-rogue'), 'footer-four' => esc_html__( 'Footer 4', 'pirate-rogue'), ) ); // Switch default core markup to output valid HTML5. add_theme_support( 'html5', array( 'gallery', 'caption', ) ); // Implement the Custom Header feature require get_template_directory() . '/inc/custom-header.php'; // Enable support for Video Post Formats. add_theme_support( 'post-formats', array ( 'video', ) ); // Enable support for custom logo. add_theme_support( 'custom-logo', array( 'height' => 236, 'width' => 520, 'flex-height' => true, 'flex-width' => true, ) ); /* Excerpts für Seiten */ add_post_type_support('page', 'excerpt'); // This theme uses post thumbnails. add_theme_support( 'post-thumbnails' ); // Adding several sizes for Post Thumbnails add_image_size( 'pirate-rogue-standard-blog', 1024, 576, true ); add_image_size( 'pirate-rogue-featured', 1440, 530, true ); add_image_size( 'pirate-rogue-featured-big', 1440, 690, true ); add_image_size( 'pirate-rogue-bigthumb', 1440, 580, true ); add_image_size( 'pirate-rogue-front-big', 1260, 709, true ); add_image_size( 'pirate-rogue-gallery', 600, 600, true ); add_image_size( 'pirate-rogue-front-small', 800, 450, true ); add_image_size( 'pirate-rogue-featured-bottom', 800, 450, true ); } add_action( 'init', 'pirate_rogue_setup' ); /*-----------------------------------------------------------------------------------*/ /* Sets up the content width value based on the theme's design. /*-----------------------------------------------------------------------------------*/ if ( ! isset( $content_width ) ) { $content_width = 900; } function pirate_rogue_content_width() { if ( is_page_template('full-width.php') ) { $GLOBALS['content_width'] = 1500; } } add_action( 'template_redirect', 'pirate_rogue_content_width' ); /*-----------------------------------------------------------------------------------*/ /* JavaScript detection. /* Adds a `js` class to the root `` element when JavaScript is detected. /*-----------------------------------------------------------------------------------*/ function pirate_rogue_javascript_detection() { echo "\n"; } add_action( 'wp_head', 'pirate_rogue_javascript_detection', 0 ); /*-----------------------------------------------------------------------------------*/ /* Registre Scripts /*-----------------------------------------------------------------------------------*/ function pirate_rogue_register_scripts() { // Register Slick wp_register_script('pirate-rogue-slick', get_template_directory_uri() . '/js/slick/slick-1.8.1.min.js', array('jquery') ); // Misc jQuery Plugins wp_register_script( 'pirate-rogue-jquery-misc', get_template_directory_uri() . '/js/jquery.misc.js', array( 'jquery' ), '1.1' ); } add_action('init', 'pirate_rogue_register_scripts'); /*-----------------------------------------------------------------------------------*/ /* Enqueue scripts and styles that are beeing used always /*-----------------------------------------------------------------------------------*/ function pirate_rogue_base_scripts() { global $wp_styles; // Loads JavaScript to pages with the comment form to support sites with threaded comments (when in use) if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } $theme_data = wp_get_theme(); $theme_version = $theme_data->Version; // Loads stylesheets. wp_enqueue_style( 'pirate-rogue-style', get_stylesheet_uri(), array(), $theme_version ); // Loads Custom JavaScript functionality wp_enqueue_script( 'pirate-rogue-script', get_template_directory_uri() . '/js/functions.min.js', array( 'jquery' ), $theme_version, true ); wp_localize_script( 'pirate-rogue-script', 'screenReaderText', array( 'expand' => '' . esc_html__( 'Expand Child Menu', 'pirate-rogue') . '', 'collapse' => '' . esc_html__( 'Collapse Child Menu', 'pirate-rogue') . '', ) ); if (is_home() && ( '' != get_theme_mod( 'pirate_rogue_featuredtag' ) || '' != get_theme_mod( 'pirate_rogue_featuredcat' ) )) { wp_enqueue_script( 'pirate-rogue-slick' ); } wp_enqueue_script( 'pirate-rogue-jquery-misc' ); } add_action( 'wp_enqueue_scripts', 'pirate_rogue_base_scripts' ); /*-----------------------------------------------------------------------------------*/ /* Admin Styles /*-----------------------------------------------------------------------------------*/ function pirate_rogue_admin_style() { $theme_data = wp_get_theme(); $theme_version = $theme_data->Version; // This theme styles the visual editor to resemble the theme style. // add_editor_style( array( '/css/admin.css') ); wp_register_style( 'themeadminstyle', get_template_directory_uri().'/css/admin.css',array(), $theme_version ); wp_enqueue_style( 'themeadminstyle' ); wp_enqueue_media(); } add_action( 'admin_enqueue_scripts', 'pirate_rogue_admin_style' ); /*-----------------------------------------------------------------------------------*/ /* Get our wp_nav_menu() fallback, wp_page_menu(), to show a home link. /*-----------------------------------------------------------------------------------*/ function pirate_rogue_page_menu_args( $args ) { $args['show_home'] = true; return $args; } add_filter( 'wp_page_menu_args', 'pirate_rogue_page_menu_args' ); /*-----------------------------------------------------------------------------------*/ /* Sets the authordata global when viewing an author archive. /*-----------------------------------------------------------------------------------*/ function pirate_rogue_setup_author() { global $wp_query; if ( $wp_query->is_author() && isset( $wp_query->post ) ) { $GLOBALS['authordata'] = get_userdata( $wp_query->post->post_author ); } } add_action( 'wp', 'pirate_rogue_setup_author' ); /*-----------------------------------------------------------------------------------*/ /* Add title to custom menu /*-----------------------------------------------------------------------------------*/ function pirate_rogue_get_menu_by_location( $location ) { if( empty($location) ) return false; $locations = get_nav_menu_locations(); if( ! isset( $locations[$location] ) ) return false; $menu_obj = get_term( $locations[$location], 'nav_menu' ); return $menu_obj; } /*-----------------------------------------------------------------------------------*/ /* Add custom max excerpt lengths. /*-----------------------------------------------------------------------------------*/ function pirate_rogue_custom_excerpt_length( $length ) { return 23; } add_filter( 'excerpt_length', 'pirate_rogue_custom_excerpt_length', 999 ); /*-----------------------------------------------------------------------------------*/ /* Replace "[...]" with custom read more in excerpts. /*-----------------------------------------------------------------------------------*/ function pirate_rogue_excerpt_more( $more ) { global $post; return '…'; } add_filter( 'excerpt_more', 'pirate_rogue_excerpt_more' ); /*-----------------------------------------------------------------------------------*/ /* Featured Slider Function /*-----------------------------------------------------------------------------------*/ function pirate_rogue_has_featured_posts( $minimum = 1 ) { if ( is_paged() ) return false; $minimum = absint( $minimum ); $featured_posts = apply_filters( 'uku_get_featured_posts', array() ); if ( ! is_array( $featured_posts ) ) return false; if ( $minimum > count( $featured_posts ) ) return false; return true; } /*-----------------------------------------------------------------------------------*/ /* Add Twitter Username to User Profile /*-----------------------------------------------------------------------------------*/ function add_twitter_contactmethod( $contactmethods ) { // Add Twitter if ( !isset( $contactmethods['twitter'] ) ) $contactmethods['twitter'] = 'Twitter Name'; return $contactmethods; } add_filter( 'user_contactmethods', 'add_twitter_contactmethod', 10, 1 ); /*-----------------------------------------------------------------------------------*/ /* Add Theme Customizer CSS /*----------------------------------------------------------------------------------- function pirate_rogue_customize_css() { $customcss = ''; if ('' != get_theme_mod( 'pirate_rogue_custom_css' ) ) { $customcss .= get_theme_mod('pirate_rogue_custom_css'); } if (!empty($customcss)) { echo ''."\n"; } } add_action( 'wp_head', 'pirate_rogue_customize_css'); */ /*-----------------------------------------------------------------------------------*/ /* Add Google Webmaster Tools Verification /*-----------------------------------------------------------------------------------*/ function pirate_rogue_google_verification() { $customcss = ''; if ('' != get_theme_mod( 'pirate_rogue_google_wmt_verification_text' ) ) { $verificationcode = get_theme_mod('pirate_rogue_google_wmt_verification_text'); } if (!empty($verificationcode)) { echo ''."\n"; } } add_action( 'wp_head', 'pirate_rogue_google_verification'); /*-----------------------------------------------------------------------------------*/ /* Add Canonical URL if need /*-----------------------------------------------------------------------------------*/ function pirate_rogue_add_canonical() { if (is_single()) { $canonical = get_post_meta( get_the_ID(), 'pirate_rogue_canonical', true ); if ($canonical) { $canonical = esc_url( $canonical ); if ($canonical) { echo ''."\n"; } } } } add_action( 'wp_head', 'pirate_rogue_add_canonical'); /*-----------------------------------------------------------------------------------*/ /* Remove inline styles printed when the gallery shortcode is used. /*-----------------------------------------------------------------------------------*/ add_filter('use_default_gallery_style', '__return_false'); if ( ! function_exists( 'pirate_rogue_comment' ) ) : /*-----------------------------------------------------------------------------------*/ /* Comments template pirate_rogue_comment /*-----------------------------------------------------------------------------------*/ function pirate_rogue_comment( $comment, $args, $depth ) { $GLOBALS['comment'] = $comment; switch ( $comment->comment_type ) : case '' : ?>
widgets['WP_Widget_Recent_Comments'], 'recent_comments_style')); } add_action('widgets_init', 'remove_recent_comments_style'); /*-----------------------------------------------------------------------------------*/ /* Register widgetized areas /*-----------------------------------------------------------------------------------*/ function pirate_rogue_widgets_init() { register_sidebar( array ( 'name' => esc_html__( 'Blog Sidebar', 'pirate-rogue'), 'id' => 'sidebar-1', 'description' => esc_html__( 'Widgets appear in the default sidebar.', 'pirate-rogue'), 'before_widget' => '", 'before_title' => '