From c3c3e84f7e29cffa91daa4e97c62e8d97be9b7ca Mon Sep 17 00:00:00 2001 From: Ryan Lerch Date: Jun 21 2016 11:51:13 +0000 Subject: Added filter to use the CDN for images --- diff --git a/communityblog-theme/functions.php b/communityblog-theme/functions.php index 92161eb..1ff497b 100644 --- a/communityblog-theme/functions.php +++ b/communityblog-theme/functions.php @@ -4,16 +4,16 @@ add_action( 'after_setup_theme', 'lingonberry_setup' ); function lingonberry_setup() { - + // Automatic feed add_theme_support( 'automatic-feed-links' ); - + // Custom background add_theme_support( 'custom-background' ); - + // Post formats add_theme_support( 'post-formats', array( 'aside', 'audio', 'chat', 'gallery', 'image', 'link', 'quote', 'status', 'video' ) ); - + // Post thumbnails add_theme_support( 'post-thumbnails', array( 'post', 'page' ) ); add_image_size( 'post-image', 766, 9999 ); @@ -21,18 +21,18 @@ function lingonberry_setup() { // Custom header (logo) $custom_header_args = array( 'width' => 200, 'height' => 200, 'header-text' => false ); add_theme_support( 'custom-header', $custom_header_args ); - + // Add nav menu register_nav_menu( 'primary', 'Primary Menu' ); - + // Make the theme translation ready load_theme_textdomain('lingonberry', get_template_directory() . '/languages'); - + $locale = get_locale(); $locale_file = get_template_directory() . "/languages/$locale.php"; if ( is_readable($locale_file) ) require_once($locale_file); - + } // Enqueue Javascript files @@ -69,7 +69,7 @@ add_action( 'init', 'lingonberry_add_editor_styles' ); // Add footer widget areas -add_action( 'widgets_init', 'lingonberry_sidebar_reg' ); +add_action( 'widgets_init', 'lingonberry_sidebar_reg' ); function lingonberry_sidebar_reg() { register_sidebar(array( @@ -80,7 +80,7 @@ function lingonberry_sidebar_reg() { 'after_title' => '', 'before_widget' => '
', 'after_widget' => '
' - )); + )); register_sidebar(array( 'name' => __( 'Footer B', 'lingonberry' ), 'id' => 'footer-b', @@ -100,10 +100,10 @@ function lingonberry_sidebar_reg() { 'after_widget' => '
' )); } - + // Add theme widgets -require_once (get_template_directory() . "/widgets/dribbble-widget.php"); -require_once (get_template_directory() . "/widgets/flickr-widget.php"); +require_once (get_template_directory() . "/widgets/dribbble-widget.php"); +require_once (get_template_directory() . "/widgets/flickr-widget.php"); require_once (get_template_directory() . "/widgets/video-widget.php"); @@ -170,7 +170,7 @@ class lingonberry_nav_walker extends Walker_Nav_Menu { add_action('body_class', 'lingonberry_if_featured_image_class' ); function lingonberry_if_featured_image_class($classes) { - if ( has_post_thumbnail() ) { + if ( has_post_thumbnail() ) { array_push($classes, 'has-featured-image'); } return $classes; @@ -190,7 +190,7 @@ function lingonberry_flexslider($size = thumbnail) { if ( is_page()) : $attachment_parent = $post->ID; - else : + else : $attachment_parent = get_the_ID(); endif; @@ -203,14 +203,14 @@ function lingonberry_flexslider($size = thumbnail) { 'orderby' => 'menu_order', 'order' => 'ASC', ))) { ?> - +
- +
- + - + - + '', @@ -251,11 +251,11 @@ function lingonberry_fixed_img_caption_shortcode($attr, $content = null) { 'width' => '', 'caption' => '' ), $attr)); - + if ( 1 > (int) $width || empty($caption) ) return $content; if ( $id ) $id = 'id="' . esc_attr($id) . '" '; - return '
' + return '
' . do_shortcode( $content ) . '

' . $caption . '

'; } @@ -276,7 +276,7 @@ function cd_meta_box_audiourl( $post ) {

-

- array( // on allow a tags 'href' => array() // and those anchords can only have href attribute ) ); - - // Probably a good idea to make sure the data is set + + // Probably a good idea to make sure the data is set if( isset( $_POST['audiourl'] ) ) { update_post_meta( $post_id, 'audiourl', wp_kses( $_POST['audiourl'], $allowed ) ); } if( isset( $_POST['videourl'] ) ) { update_post_meta( $post_id, 'videourl', wp_kses( $_POST['videourl'], $allowed ) ); } - + } // Style the admin area function lingonberry_custom_colors() { echo ' - + + + - + \ No newline at end of file +function cdn_url() { + return 'https://cdn.communityblog.fedoraproject.org/wp-content/uploads'; +} +add_filter( 'pre_option_upload_url_path', 'cdn_url' ); +?>