Advertisement
Guest User

Untitled

a guest
Dec 6th, 2018
147
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 6.26 KB | None | 0 0
  1. <?php
  2. /**
  3.  * shopress functions and definitions.
  4.  *
  5.  * @link https://developer.wordpress.org/themes/basics/theme-functions/
  6.  *
  7.  * @package shopress
  8.  */
  9.  
  10.  
  11.     $shopress_theme_path = get_template_directory() . '/inc/icy/';
  12.  
  13.     require( $shopress_theme_path . '/shopress-custom-navwalker.php' );
  14.     require( $shopress_theme_path . '/font/font.php');
  15.  
  16.     /*-----------------------------------------------------------------------------------*/
  17.     /*  Enqueue scripts and styles.
  18.     /*-----------------------------------------------------------------------------------*/
  19.     require( $shopress_theme_path .'/enqueue.php');
  20.     /* ----------------------------------------------------------------------------------- */
  21.     /* Customizer */
  22.     /* ----------------------------------------------------------------------------------- */
  23.    
  24.     require( $shopress_theme_path . '/customize/shopress_customize_copyright.php');
  25.     require( $shopress_theme_path . '/customize/shopress_customize_homepage.php');
  26.     require( $shopress_theme_path . '/customize/customize_control/class-shopress-customize-alpha-color-control.php');
  27.    
  28.    
  29.    
  30.     /*
  31.      * Load customize pro
  32.     */
  33.     require_once( trailingslashit( get_template_directory() ) . 'inc/icy/customize-pro/class-customize.php' );
  34.  
  35. /**
  36.  * Sets up theme defaults and registers support for various WordPress features.
  37.  *
  38.  * Note that this function is hooked into the after_setup_theme hook, which
  39.  * runs before the init hook. The init hook is too late for some features, such
  40.  * as indicating support for post thumbnails.
  41.  */
  42. function shopress_setup() {
  43.     /*
  44.      * Make theme available for translation.
  45.      * Translations can be filed in the /languages/ directory.
  46.      * If you're building a theme based on shopress, use a find and replace
  47.      * to change 'shopress' to the name of your theme in all the template files.
  48.      */
  49.     load_theme_textdomain( 'shopress', get_template_directory() . '/languages' );
  50.  
  51.     // Add default posts and comments RSS feed links to head.
  52.     add_theme_support( 'automatic-feed-links' );
  53.  
  54.    
  55.  
  56.     /*
  57.      * Let WordPress manage the document title.
  58.      * By adding theme support, we declare that this theme does not use a
  59.      * hard-coded <title> tag in the document head, and expect WordPress to
  60.      * provide it for us.
  61.      */
  62.     add_theme_support( 'title-tag' );
  63.  
  64.     /*
  65.      * Enable support for Post Thumbnails on posts and pages.
  66.      *
  67.      * @link https://developer.wordpress.org/themes/functionality/featured-images-post-thumbnails/
  68.      */
  69.     add_theme_support( 'post-thumbnails' );
  70.  
  71.     // This theme uses wp_nav_menu() in one location.
  72.     register_nav_menus( array(
  73.         'primary' => __( 'Primary menu', 'shopress' ),
  74.         'top-left' => __( 'Top Left Menu', 'shopress' ),
  75.         'top-right' => __( 'Top Right Menu', 'shopress' ),
  76.     ) );
  77.  
  78.     /*
  79.      * Switch default core markup for search form, comment form, and comments
  80.      * to output valid HTML5.
  81.      */
  82.     add_theme_support( 'html5', array(
  83.         'comment-list',
  84.         'gallery',
  85.         'caption',
  86.     ) );
  87.  
  88.     // Set up the woocommerce feature.
  89.     add_theme_support( 'woocommerce');
  90.    
  91.     //Custom logo
  92.     add_theme_support( 'custom-logo');
  93.    
  94.    
  95.         // custom header
  96.         $args = array(
  97.         'default-image'     =>  get_template_directory_uri() .'/images/breadcrumb-back.jpg',
  98.         'width'         => '1600',
  99.         'height'        => '500',
  100.         'flex-height'       => false,
  101.         'flex-width'        => false,
  102.         'header-text'       => true,
  103.         'default-text-color'    => '#143745'
  104.         );
  105.         add_theme_support( 'custom-header', $args );
  106.  
  107. }
  108. add_action( 'after_setup_theme', 'shopress_setup' );
  109.  
  110.     function shopress_the_custom_logo() {
  111.    
  112.     if ( function_exists( 'the_custom_logo' ) ) {
  113.         the_custom_logo();
  114.     }
  115.  
  116.     }
  117.  
  118.     add_filter('get_custom_logo','shopress_logo_class');
  119.  
  120.  
  121.     function shopress_logo_class($html)
  122.     {
  123.     $html = str_replace('custom-logo-link', 'navbar-brand', $html);
  124.     return $html;
  125.     }
  126.  
  127. /**
  128.  * Set the content width in pixels, based on the theme's design and stylesheet.
  129.  *
  130.  * Priority 0 to make it available to lower priority callbacks.
  131.  *
  132.  * @global int $content_width
  133.  */
  134. function shopress_content_width() {
  135.     $GLOBALS['content_width'] = apply_filters( 'shopress_content_width', 640 );
  136. }
  137. add_action( 'after_setup_theme', 'shopress_content_width', 0 );
  138.  
  139. /**
  140.  * Register widget area.
  141.  *
  142.  * @link https://developer.wordpress.org/themes/functionality/sidebars/#registering-a-sidebar
  143.  */
  144. function shopress_widgets_init() {
  145.     register_sidebar( array(
  146.         'name'          => esc_html__( 'Sidebar', 'shopress' ),
  147.         'id'            => 'sidebar-1',
  148.         'description'   => '',
  149.         'before_widget' => '<div id="%1$s" class="shopress-widget %2$s">',
  150.         'after_widget'  => '</div>',
  151.         'before_title'  => '<h6>',
  152.         'after_title'   => '</h6>',
  153.     ) );
  154.  
  155.     register_sidebar( array(
  156.         'name'          => esc_html__( 'Footer Widget Area', 'shopress' ),
  157.         'id'            => 'footer_widget_area',
  158.         'description'   => '',
  159.         'before_widget' => '<div id="%1$s" class="col-md-3 col-sm-6 rotateInDownLeft animated shopress-widget %2$s">',
  160.         'after_widget'  => '</div>',
  161.         'before_title'  => '<h6>',
  162.         'after_title'   => '</h6>',
  163.     ) );
  164. }
  165. add_action( 'widgets_init', 'shopress_widgets_init' );
  166.  
  167. /* Implement the Custom Header feature. */
  168.  
  169. //Get slider excerpt
  170. function shopress_slider_excerpt()
  171.     {
  172.         global $post;
  173.         $excerpt = get_the_content();
  174.         $excerpt = strip_tags(preg_replace(" (\[.*?\])",'',$excerpt));
  175.         $excerpt = strip_shortcodes($excerpt);     
  176.         $original_len = strlen($excerpt);
  177.         $excerpt = substr($excerpt, 0, 100);       
  178.         $len=strlen($excerpt);   
  179.         if($original_len>200) {
  180.         $excerpt = $excerpt;
  181.         return $excerpt . '<div><a href="' . esc_url(get_permalink()) . '" class="btn btn-theme margin-bottom-10">'.__("Read More","shopress").'</a></div>';
  182.         }
  183.         else
  184.         { return $excerpt; }
  185.     }
  186.  
  187.        
  188.        
  189.         register_default_headers( array(
  190.             'mypic' => array(
  191.             'url'   => get_template_directory_uri() . '/images/page-header-bg.jpg',
  192.             'thumbnail_url' => get_template_directory_uri() . '/images/breadcrumb/background.jpg',
  193.             'description'   => _x( 'headerPic', 'header image description', 'shopress' )),
  194.         ));
  195.        
  196. //Read more Button on slider & Post
  197. function shopress_read_more() {
  198.    
  199.     global $post;
  200.    
  201.     $readbtnurl = '<a class="btn btn-theme" href="' . get_permalink() . '">'.__('Read More','shopress').'</a>';
  202.    
  203.     return $readbtnurl;
  204. }
  205. add_filter( 'the_content_more_link', 'shopress_read_more' );
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement