'#ddd' ) ); // Adds support of custom header add_theme_support( 'custom-header' ); // Adds RSS feed links to for posts and comments. add_theme_support( 'automatic-feed-links' ); add_theme_support( 'title-tag' ); // Styles the visual editor with editor-style.css add_editor_style(); // Custom image size for featured images add_image_size( 'post-featured-image', 542, 9999 ); // image size for slider add_image_size( 'slide', 940, 344, true ); // image size for attachment add_image_size( 'attachment', 540, 360, true ); // image size for custom-header add_image_size( 'custom-header', 940, 9999, true ); // register menu of theme register_nav_menu( 'primary', __( 'Navigation Menu', 'archy' ) ); } // Adds script of navigation menu function archy_register_scripts() { // Adds JavaScript to pages with the comment form to support sites with // threaded comments (when in use). if ( is_singular() && comments_open() ) { wp_enqueue_script( 'comment-reply' ); } // Adds functions realized on script.js wp_enqueue_script( 'archy-script', get_template_directory_uri() . '/js/script.js', array( 'jquery', 'jquery-ui-core', 'jquery-effects-core', 'jquery-effects-drop', ) ); //Detect plugin. For use on Front End only. include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); // Adds script oriented for http://wordpress.org/plugins/gallery-plugin/ and http://bestwebsoft.com/plugin/portfolio-plugin/ // check for plugin using plugin name if ( is_plugin_active( 'gallery-plugin/gallery-plugin.php' ) || is_plugin_active( 'portfolio/portfolio.php' ) ) { wp_enqueue_script( 'archy-pluginsScript', get_template_directory_uri() . '/js/plugins-script.js' ); } // Load the main stylesheet wp_enqueue_style( 'archy-style', get_stylesheet_uri() ); // Loads the Internet Explorer specific stylesheet. wp_enqueue_style( 'archy-style-ie', get_template_directory_uri() . '/styles/ie78.css', array( 'archy-style' ) ); wp_style_add_data( 'archy-style-ie', 'conditional', 'lt IE 9' ); } /* backwards compatibility title-tag */ if ( ! function_exists( '_wp_render_title_tag' ) ) { /* customize title if WP version < 4.1 */ function archy_wp_title( $title, $sep = '|' ) { global $page, $paged; if ( is_feed() ) { return $title; } /* Add the blog name */ $title .= get_bloginfo( 'name' ); /* Add the blog description for the home/front page. */ $site_description = get_bloginfo( 'description', 'display' ); if ( $site_description && ( is_home() || is_front_page() ) ) { $title .= " $sep $site_description "; } /* Add a page number if necessary: */ if ( $paged >= 2 || $page >= 2 ) { $title .= " $sep " . sprintf( __( 'Page %s', 'archy' ), max( $paged, $page ) ); } return $title; } /* add wp_title filter if WP version < 4.1 */ add_filter( 'wp_title', 'archy_wp_title' ); /* render title in wp_head if WP version < 4.1 */ function archy_render_title() { ?> <?php wp_title( '|', true, 'right' ); ?> __( 'Main Sidebar', 'archy' ), 'id' => 'sidebar-1', 'description' => __( 'Appears posts and pages', 'archy' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); } //function to show the caption of thumbnail function archy_the_post_caption( $size = '', $attr = '' ) { global $post; $thumb_id = get_post_thumbnail_id( $post->ID ); $args = array( 'post_type' => 'attachment', 'post_status' => null, 'parent' => $post->ID, 'include' => $thumb_id, ); $thumbnail_image = get_posts( $args ); if ( $thumb_id && $thumbnail_image && isset( $thumbnail_image[0] ) ) { // Showing the thumbnail caption $caption = $thumbnail_image[0]->post_excerpt; if ( $caption ) { $output = '

'; $output .= $caption; $output .= '

'; echo $output; }; } } /* * Adds a box to the main column on the Post and Page edit screens. */ function archy_slider_add_custom_box() { $screens = array( 'post', 'page' ); foreach ( $screens as $screen ) { add_meta_box( 'showonslider', __( 'Slider', 'archy' ), 'archy_slider_inner_custom_box', $screen ); } } if ( ! function_exists( 'slider_inner_custom_box' ) ) : /** * Prints the box content. * * @param WP_Post $post The object for the current post/page. */ function archy_slider_inner_custom_box( $post ) { // Add an nonce field so we can check for it later. wp_nonce_field( 'slider_inner_custom_box', 'slider_inner_custom_box_nonce' ); /* * Use get_post_meta() to retrieve an existing value * from the database and use the value for the form. */ $caption = get_post_meta( $post->ID, '_caption_slider', true ); $is_check = get_post_meta( $post->ID, '_add_to_slider', true ); ?>
onchange="document.getElementById('slider-caption').disabled = this.checked != true;" />
array( 'post', 'page' ), 'meta_key' => '_add_to_slider', 'meta_value' => 'on', 'posts_per_page' => '999', ) ); // The Loop if ( $the_query->have_posts() && archy_is_posts_have_thumbnails( $the_query ) >= 1 ) : ?>
have_posts() ) : $the_query->the_post(); if ( get_the_post_thumbnail( get_the_ID(), 'slide' ) ) : ?>
 
have_posts() ) { $user_query->the_post(); if ( get_the_post_thumbnail( get_the_ID(), 'slide' ) ) { $count ++; if ( 2 == $count ) { $user_query->rewind_posts(); return 2; } } } $user_query->rewind_posts(); return $count; } endif; if ( ! function_exists( 'archy_content_nav' ) ) : /** * Displays navigation to next/previous pages when applicable. * * @return void */ function archy_content_nav() { global $wp_query; if ( $wp_query->max_num_pages > 1 ) : ?>
.inside .check-to-display { margin-bottom: 5px; } .inside .check-to-display #slider-checkbox { margin-right: 4px; } .inside .check-to-display + .slider-caption { margin-right: 3px; } '; } endif; /** * Add actions */ add_action( 'after_setup_theme', 'archy_setup' ); add_action( 'admin_head', 'archy_slider_custom_styles' ); add_action( 'wp_enqueue_scripts', 'archy_register_scripts' ); add_action( 'widgets_init', 'archy_initialize_widgets' ); add_action( 'archy_post_caption', 'archy_the_post_caption' ); add_action( 'add_meta_boxes', 'archy_slider_add_custom_box' ); add_action( 'save_post', 'archy_slider_save_postdata' ); add_action( 'archy_slider', 'archy_slider' ); add_action( 'archy_content_nav', 'archy_content_nav' );