tag in the document head, and expect WordPress to * provide it for us. */ add_theme_support( 'custom-logo' ); // add_theme_support( 'custom-header', array( // 'video' => true, // ) ); /* * 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' ); load_theme_textdomain('ace-corporate', get_template_directory() . '/languages/'); add_image_size( 'ace_corporate_post_size', 800, 500, true ); add_image_size( 'ace_corporate_port_size', 800, 600, true ); add_image_size( 'ace_corporate_test_size', 100, 100, true ); // This theme uses wp_nav_menu() in one location. register_nav_menus( array( 'primary' => esc_html__( 'Header Menu','ace-corporate' ), ) ); /* * 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( 'ace_corporate_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 ); } endif; // ace_corporate_setup add_action( 'after_setup_theme', 'ace_corporate_setup' ); /** * Register widget area. * * @link http://codex.wordpress.org/Function_Reference/register_sidebar */ if (! function_exists('ace_corporate_widgets_init') ) { function ace_corporate_widgets_init() { register_sidebar( array( 'name' => esc_html__( 'Sidebar','ace-corporate' ), 'id' => 'sidebar-1', 'description' => esc_html__( 'CT Corporate Sidebar','ace-corporate' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer 1','ace-corporate' ), 'id' => 'footer-1', 'description' => esc_html__( 'Footer 1','ace-corporate' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer 2','ace-corporate' ), 'id' => 'footer-2', 'description' => esc_html__( 'Footer 2','ace-corporate' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => esc_html__( 'Footer 3','ace-corporate' ), 'id' => 'footer-3', 'description' => esc_html__( 'Footer 3','ace-corporate' ), 'before_widget' => '', 'before_title' => '

', 'after_title' => '

', ) ); } add_action( 'widgets_init', 'ace_corporate_widgets_init' ); } if (! function_exists('ace_corporate_add_editor_styles') ) { function ace_corporate_add_editor_styles() { add_editor_style( 'css/editor-style.css' ); } add_action( 'admin_init', 'ace_corporate_add_editor_styles' ); } if ( ! function_exists( 'ACE_Corporate_fonts_url' ) ) : function ACE_Corporate_fonts_url() { $fonts_url = ''; $fonts = array(); if ( 'off' !== _x( 'on', 'Montserrat:400,500,600,700 font: on or off', 'ace-corporate' ) ) { $fonts[] = 'Montserrat:300,400'; } if ( 'off' !== _x( 'on', 'Lato:300,400 font: on or off', 'ace-corporate' ) ) { $fonts[] = 'Poppins'; } if ( $fonts ) { $fonts_url = add_query_arg( array( 'family' => urlencode( implode( '|', $fonts ) ), ), '//fonts.googleapis.com/css' ); } return $fonts_url; } endif; /** * Enqueue scripts and styles. */ if(! function_exists('ace_corporate_scripts')){ function ace_corporate_scripts() { wp_enqueue_style( 'ace-corporate-lite-fonts', ACE_Corporate_fonts_url() , array(), null); wp_enqueue_style( 'ace-corporate-style', get_stylesheet_uri() ); wp_enqueue_style( 'ace-corporate-css', get_stylesheet_directory_uri() . '/css/ace-corporate.css' ); if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) { wp_enqueue_script( 'comment-reply' ); } wp_enqueue_script( 'ace-corporate-functions-js', get_template_directory_uri() . '/js/functions.js', array( 'jquery' ), 'v3.3.2', true ); wp_enqueue_script( 'jquery-slick', get_template_directory_uri() . '/js/slick.js', array( 'jquery' ), 'v3.3.2', true ); wp_enqueue_script( 'ace-corporate-vendor-js', get_stylesheet_directory_uri() . '/js/vendor.js'); wp_localize_script('jquery-slick', 'custom_localize', array( 'prev' => esc_html__('Previous', 'ace-corporate'), 'next' => esc_html__('Next', 'ace-corporate'), )); $social_media_background = ( esc_attr( get_theme_mod('social_media_background' ) ) ) ? esc_attr( get_theme_mod('social_media_background' ) ) : ''; $maxContainerWidth = '1170'; $bg_color_404 = esc_attr( get_theme_mod('background_color') ); $width = ''; $version_wp = get_bloginfo('version'); if($version_wp < 4.7){ $site_css_change = ( get_theme_mod( 'css_change' ) ) ? get_theme_mod( 'css_change' ) : ''; } else{ $site_css_change = ""; } if ( get_theme_mod('max_width') != '' ) { $containerWidth = '100'; $maxContainerWidth = get_theme_mod('max_width'); $width = "width: {$containerWidth}%"; } $minContainerWidth = '1170'; $min_width = ''; $header_text_color = get_header_textcolor(); $desc_color = $header_text_color; $custom_css = " @media (min-width: 1200px){ .container { max-width: {$maxContainerWidth}px; ".$width." } } .image-404{ background-color: #{$bg_color_404} ; } .site-title a{ color: {$desc_color} ;} .social-section{ background-image: url($social_media_background); } $site_css_change "; wp_add_inline_style( 'ace-corporate-css', $custom_css ); } add_action( 'wp_enqueue_scripts', 'ace_corporate_scripts' ); } /** * * Layout functions * **/ if(! function_exists('ace_corporate_boxedornot')){ function ace_corporate_boxedornot() { $boxedornot = 'boxed'; if ( get_theme_mod('layout_control') != '' ) { $boxedornot = esc_attr( 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. */ get_template_part('inc/customizer'); /** * Breadcrumb Option. */ require get_template_directory() . '/inc/custom-breadcrumb.php'; /** * Load Jetpack compatibility file. */ require get_template_directory() . '/inc/jetpack.php'; /** * Bootstrap integration */ require get_template_directory() . '/inc/functions-strap.php'; if(! function_exists('ace_corporate_trim_excerpt')){ function ace_corporate_trim_excerpt( $text ) { global $post; if ( '' == $text ) { $text = get_the_content(''); $text = apply_filters( 'the_content', $text ); $text = str_replace( '\]\]\>', ']]>', $text ); $alllowed_tags = ''); } elseif (0 === strpos( $content, 'https://' )) { $embed_url = wp_oembed_get( esc_url( $ori_url[0] ) ); print_r($embed_url); } ?>
$images ) { ?>
post_content ) { global $shortcode_tags; // Make a copy of global shortcode tags - we'll temporarily overwrite it. $theme_shortcode_tags = $shortcode_tags; // The shortcodes we're interested in. $shortcode_tags = array( 'video' => $theme_shortcode_tags['video'], 'embed' => $theme_shortcode_tags['embed'] ); // Get the absurd shortcode regexp. $video_regex = '#' . get_shortcode_regex() . '#i'; // Restore global shortcode tags. $shortcode_tags = $theme_shortcode_tags; $pattern_array = array( $video_regex ); // Get the patterns from the embed object. if ( ! function_exists( '_wp_oembed_get_object' ) ) { include ABSPATH . WPINC . '/class-oembed.php'; } $oembed = _wp_oembed_get_object(); $pattern_array = array_merge( $pattern_array, array_keys( $oembed->providers ) ); // Or all the patterns together. $pattern = '#(' . array_reduce( $pattern_array, function ( $carry, $item ) { if ( strpos( $item, '#' ) === 0 ) { // Assuming '#...#i' regexps. $item = substr( $item, 1, -2 ); } else { // Assuming glob patterns. $item = str_replace( '*', '(.+)', $item ); } return $carry ? $carry . ')|(' . $item : $item; } ) . ')#is'; // Simplistic parse of content line by line. $lines = explode( "\n", $post->post_content ); foreach ( $lines as $line ) { $line = trim( $line ); if ( preg_match( $pattern, $line, $matches ) ) { if ( strpos( $matches[0], '[' ) === 0 ) { $ret = do_shortcode( $matches[0] ); } else { $ret = wp_oembed_get( $matches[0] ); } return $ret; } } } }