tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'title-tag' ); /* * Enable support for Post Thumbnails on posts and pages. * * @link http://codex.wordpress.org/Function_Reference/add_theme_support#Post_Thumbnails */ add_theme_support( 'post-thumbnails' ); add_image_size( 'custom_post_size', 800, 500, true ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => __( 'Header Menu', 'charity_review' ), ) ); /* * Switch default core markup for search form, comment form, and comments * to output valid HTML5. */ add_theme_support( 'html5', array( 'search-form', 'comment-form', 'comment-list', 'gallery', 'caption', ) ); /* * Enable support for Post Formats. * See http://codex.wordpress.org/Post_Formats */ add_theme_support( 'post-formats', array( 'aside', 'image', 'video', 'quote', 'link', 'gallery', 'status', 'audio', 'chat' ) ); // Set up the WordPress core custom background feature. add_theme_support( 'custom-background', apply_filters( 'charity_review_custom_background_args', array( 'default-color' => 'ffffff', 'default-image' => '', 'default-repeat'=> 'repeat', ) ) ); //Site logo from jetpack $args = array( 'header-text' => array( 'site-title', 'site-description', ), 'size' => 'medium', ); add_theme_support( 'site-logo', $args ); add_editor_style( get_template_directory(). '/css/editor-style.css' ); } endif; // charity_review_setup add_action( 'after_setup_theme', 'charity_review_setup' ); /** * Register widget area. * * @link http://codex.wordpress.org/Function_Reference/register_sidebar */ if (! function_exists('charity_review_widgets_init') ) { function charity_review_widgets_init() { register_sidebar( array( 'name' => __( 'Sidebar', 'charity_review' ), 'id' => 'sidebar-1', 'description' => __( 'Charity Review Sidebar', 'charity_review' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer 1', 'charity_review' ), 'id' => 'footer-1', 'description' => __( 'Footer 1', 'charity_review' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer 2', 'charity_review' ), 'id' => 'footer-2', 'description' => __( 'Footer 2', 'charity_review' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Footer 3', 'charity_review' ), 'id' => 'footer-3', 'description' => __( 'Footer 3', 'charity_review' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'charity_review_widgets_init' ); } if (! function_exists('charity_review_add_editor_styles') ) { function charity_review_add_editor_styles() { add_editor_style( 'css/editor-style.css' ); } add_action( 'admin_init', 'charity_review_add_editor_styles' ); } /** * Enqueue scripts and styles. */ if(! function_exists('charity_review_scripts')){ function charity_review_scripts() { wp_enqueue_style( '_s-style', get_stylesheet_uri() ); wp_enqueue_style( 'charity-css', get_stylesheet_directory_uri() . '/css/charity.min.css' ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } wp_enqueue_script( 'fucntions-js', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), 'v3.3.2', true ); wp_enqueue_script( 'vendor-js', get_stylesheet_directory_uri() . '/js/vendor.js'); wp_enqueue_script( 'fitvid-js', get_stylesheet_directory_uri() . '/js/vendor/jquery.fitvids.js'); $color = ( get_theme_mod( 'logo_background_color' ) ) ? get_theme_mod( 'logo_background_color' ) : '#0072bc'; $hover_color = ( get_theme_mod( 'hover_background_color' ) ) ? get_theme_mod( 'hover_background_color' ) : '#cb2a2a'; $from_blog_background = ( get_theme_mod('from_the_blog_background') ) ? get_theme_mod('from_the_blog_background') : ''; $social_media_background = ( get_theme_mod('social_media_background' ) ) ? get_theme_mod('social_media_background' ) : ''; $maxContainerWidth = '1170'; $bg_color_404 = get_theme_mod('background_color'); $width = ''; if ( get_theme_mod('max_width') != '' ) { $containerWidth = '100'; $maxContainerWidth = get_theme_mod('max_width'); $width = "width: {$containerWidth}%"; } $minContainerWidth = '1170'; $min_width = ''; $custom_css = " @media (min-width: 1200px){ .container { max-width: {$maxContainerWidth}px; ".$width." } } .site-branding { background: none repeat scroll 0% 0% {$color}; box-shadow: 0px -12px 0px 0px {$color}; } .site-branding::before { border-left: 12px solid {$color}; } .image-404 { background-color: #{$bg_color_404} ; } .navbar .site-branding:hover { background: none repeat scroll 0% 0% {$hover_color}; box-shadow: 0px -12px 0px 0px {$hover_color}; } .navbar .site-branding:hover:before { border-left: 12px solid {$hover_color}; } .section.blogroll { background: #fff url($from_blog_background) repeat center center scroll; background-size: cover; } .social-section { background: url($social_media_background) repeat center center scroll #FFF; } "; wp_add_inline_style( 'charity-css', $custom_css ); } add_action( 'wp_enqueue_scripts', 'charity_review_scripts' ); } /** * * Layout functions * **/ if(! function_exists('charity_review_boxedornot')){ function charity_review_boxedornot() { $boxedornot = 'boxed'; if ( get_theme_mod('layout_control') != '' ) { $boxedornot = get_theme_mod('layout_control'); } return $boxedornot; } } /** } * Custom template tags for this theme. */ require get_template_directory() . '/inc/template-tags.php'; /** * Custom functions that act independently of the theme templates. */ require get_template_directory() . '/inc/extras.php'; require get_template_directory() . '/inc/custom-header.php'; /** * Customizer additions. */ if(! function_exists('charity_review_activation_message')){ function charity_review_activation_message() { function charity_review_admin_notice() { ?>

Customizer to set up your site.', 'charity_review' ); ?>

', ']]>', $text ); // $alllowed_tags = '

"'. _e( 'TOGETHER WE CAN MAKE A DIFFERENCE', 'charity_review').'"

"'. _e( 'Volunteerism is a powerful means of engaging people in addressing developement challenges', 'charity_review').'"

Get Involved.

"'. _e( 'TOGETHER WE CAN MAKE A DIFFERENCE', 'charity_review').'"

"'. _e( 'Volunteerism is a powerful means of engaging people in addressing developement challenges', 'charity_review').'"

Get Involved.

"'. _e( 'TOGETHER WE CAN MAKE A DIFFERENCE', 'charity_review').'"

"'. _e( 'Volunteerism is a powerful means of engaging people in addressing developement challenges', 'charity_review').'"

Get Involved.
'); } } if(! function_exists('charity_review_cc_mime_types')){ function charity_review_cc_mime_types($mimes) { $mimes['svg'] = 'image/svg+xml'; return $mimes; } add_filter('upload_mimes', 'charity_review_cc_mime_types'); } if(! function_exists('charity_review_woocommerce_support')){ add_action( 'after_setup_theme', 'charity_review_woocommerce_support' ); function charity_review_woocommerce_support() { add_theme_support( 'woocommerce' ); } } // Disqus Mods /** * Detect plugin. For use on Front End only. */ include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); if(! function_exists('charity_review_check_for_discus')){ function charity_review_check_for_discus() { // check for plugin using plugin name if ( is_plugin_active( 'disqus-comment-system/disqus.php' ) ) { $disqus_active = true; } else { $disqus_active = false; } return $disqus_active; } } if ( !function_exists( 'get_home_path' ) ) require_once( dirname(__FILE__) . '/../../../wp-admin/includes/file.php' ); // Shorten title if ( ! function_exists( 'charity_review_limit_title' ) ) { function charity_review_limit_title($text, $chars_limit){ // Change to the number of characters you want to display $chars_text = strlen($text); $text = $text." "; $text = substr($text,0,$chars_limit); $text = substr($text,0,strrpos($text,' ')); // If the text has more characters that your limit, //add ... so the user knows the text is actually longer if ($chars_text > $chars_limit) { $text = $text."..."; } return $text; } } /** * Include the TGM_Plugin_Activation class. */ get_template_part('plugin', 'activation'); if (! function_exists('charity_review_register_required_plugins') ) { add_action( 'tgmpa_register', 'charity_review_register_required_plugins' ); /** * Register the required plugins for this theme. * * In this example, we register five plugins: * - one included with the TGMPA library * - two from an external source, one from an arbitrary source, one from a GitHub repository * - two from the .org repo, where one demonstrates the use of the `is_callable` argument * * The variable passed to tgmpa_register_plugins() should be an array of plugin * arrays. * * This function is hooked into tgmpa_init, which is fired within the * TGM_Plugin_Activation class constructor. */ function charity_review_register_required_plugins() { /* * Array of plugin arrays. Required keys are name and slug. * If the source is NOT from the .org repo, then source is also required. */ $plugins = array( array( 'name' => 'Jetpack', 'slug' => 'jetpack', 'required' => true, ), ); /* * Array of configuration settings. Amend each line as needed. * * TGMPA will start providing localized text strings soon. If you already have translations of our standard * strings available, please help us make TGMPA even better by giving us access to these translations or by * sending in a pull-request with .po file(s) with the translations. * * Only uncomment the strings in the config array if you want to customize the strings. */ $config = array( 'id' => 'tgmpa', // Unique ID for hashing notices for multiple instances of TGMPA. 'default_path' => '', // Default absolute path to bundled plugins. 'menu' => 'tgmpa-install-plugins', // Menu slug. 'parent_slug' => 'themes.php', // Parent menu slug. 'capability' => 'edit_theme_options', // Capability needed to view plugin install page, should be a capability associated with the parent menu used. 'has_notices' => true, // Show admin notices or not. 'dismissable' => true, // If false, a user cannot dismiss the nag message. 'dismiss_msg' => '', // If 'dismissable' is false, this message will be output at top of nag. 'is_automatic' => false, // Automatically activate plugins after installation or not. 'message' => '', // Message to output right before the plugins table. ); tgmpa( $plugins, $config ); } } if ( ! function_exists( 'charity_review_the_featured_video' ) ) { function charity_review_the_featured_video( $content ) { // $ori_url = trim( array_shift( explode( "\n", $content ) ) ); $ori_url = explode( "\n", $content ); $url = $ori_url[0]; // var_dump($url); $w = get_option( 'embed_size_w' ); if ( !is_single() ) $url = str_replace( '448', $w, $url ); if ( 0 === strpos( $url, 'https://' ) ) { echo apply_filters( 'the_content', $url ); $content = trim( str_replace( $url, '', $content ) ); } elseif ( preg_match ( '#^<(script|iframe|embed|object)#i', $url ) ) { $h = get_option( 'embed_size_h' ); echo $url; if ( !empty( $h ) ) { if ( $w === $h ) $h = ceil( $w * 0.75 ); $url = preg_replace( array( '#height="[0-9]+?"#i', '#height=[0-9]+?#i' ), array( sprintf( 'height="%d"', $h ), sprintf( 'height=%d', $h ) ), $url ); echo $url; } $content = trim( str_replace( $url, '', $content ) ); } } } if(!function_exists('charity_review_strip_url_content')){ function charity_review_strip_url_content($posttype, $content_length){ $strip = explode( ' ' , strip_shortcodes(wp_trim_words( $posttype->post_content , $content_length )) ); foreach($strip as $key => $single){ if (!filter_var($single, FILTER_VALIDATE_URL) === false) { unset($strip[$key]); } } return implode( ' ', $strip ); } }