'ffffff' ); add_theme_support( 'custom-background', $defaults ); /** * Add wide image support */ add_theme_support( 'align-wide' ); /** * Selective Refresh for Customizer */ add_theme_support( 'customize-selective-refresh-widgets' ); // Add excerpt support to pages add_post_type_support( 'page', 'excerpt' ); // Featured image add_image_size( 'atomic-blocks-featured-image', 1200 ); // Wide featured image add_image_size( 'atomic-blocks-featured-image-wide', 1400 ); // Logo size add_image_size( 'atomic-blocks-logo', 300 ); /** * Register Navigation menu */ register_nav_menus( array( 'primary' => esc_html__( 'Primary Menu', 'atomic-blocks' ), 'social' => esc_html__( 'Social Icon Menu', 'atomic-blocks' ), ) ); /** * Add Site Logo feature */ add_theme_support( 'custom-logo', array( 'header-text' => array( 'titles-wrap' ), 'size' => 'atomic-blocks-logo', ) ); /** * Enable HTML5 markup */ add_theme_support( 'html5', array( 'comment-form', 'gallery', ) ); /** * Enable post formats */ add_theme_support( 'post-formats', array( 'video', 'gallery' ) ); } endif; // atomic_blocks_setup add_action( 'after_setup_theme', 'atomic_blocks_setup' ); /** * Add Carousel image size to gallery select */ function atomic_blocks_carousel_image_sizes( $sizes ) { $addsizes = array( "atomic-blocks-portfolio-carousel" => esc_html__( 'Carousel', 'atomic-blocks' ), ); $newsizes = array_merge( $sizes, $addsizes ); return $newsizes; } add_filter( 'image_size_names_choose', 'atomic_blocks_carousel_image_sizes' ); /** * Set the content width based on the theme's design and stylesheet */ function atomic_blocks_content_width() { if ( has_post_format( 'gallery' ) ) { $GLOBALS['content_width'] = apply_filters( 'atomic_blocks_content_width', 1400 ); } else { $GLOBALS['content_width'] = apply_filters( 'atomic_blocks_content_width', 905 ); } } add_action( 'after_setup_theme', 'atomic_blocks_content_width', 0 ); /** * Gets the gallery shortcode data from post content. */ function atomic_blocks_gallery_data() { global $post; $pattern = get_shortcode_regex(); if ( preg_match_all( '/'. $pattern .'/s', $post->post_content, $matches ) && array_key_exists( 2, $matches ) && in_array( 'gallery', $matches[2] ) ) { return $matches; } } /** * Disply the featured image, gallery or video associated with the post * * @since Atomic Blocks 1.0 */ function atomic_blocks_post_media() { global $post, $wp_embed; // Get the post content $content = apply_filters( 'the_content', $post->post_content ); // Check for video post format content $media = get_media_embedded_in_content( $content ); // If it's a video format, get the first video embed from the post to replace the featured image if ( has_post_format( 'video' ) && ! empty( $media ) ) { echo ''; } else if ( has_post_thumbnail() ) { $page_template = get_post_meta( $post->ID, '_wp_page_template', true ); if ( $page_template == 'templates/template-wide-image.php' ) { $featured_image = get_the_post_thumbnail_url( $post, 'atomic-blocks-featured-image-wide' ); } else { $featured_image = get_the_post_thumbnail_url( $post, 'atomic-blocks-featured-image' ); } // Otherwise get the featured image echo '