prefix = 'mp_artwork'; $this->define_constant(); $this->init(); $this->add_actions(); } /** * Add theme actions. * * @access public * @return voi */ public function add_actions() { add_action('after_setup_theme', array($this, 'setup')); add_action('wp_print_styles', array($this, 'load_google_fonts')); add_action('wp_enqueue_scripts', array($this, 'scripts_styles')); add_action('widgets_init', array($this, 'widgets_init')); if (!function_exists('_wp_render_title_tag')) { add_action('wp_head', array($this, 'slug_render_title')); } add_action('after_setup_theme', array($this, 'woocommerce_support')); } /** * Add theme add_filters. * * @access public * @return voi */ public function add_filters() { add_filter('excerpt_length', array($this, 'excerpt_length', 999)); add_filter('wp_audio_shortcode', array($this, 'audio_short_fix', 10, 5)); } /** * Get prefix. * * @access public * @return sting */ private function get_prefix() { return $this->prefix . '_'; } /** * Set constants. * * @access private * @return void */ private function define_constant() { define('MP_ARTWORK_DEFAULT_ADDRESS', '24 Hillside Gardens, Northwood'); define('MP_ARTWORK_DEFAULT_OPEN_HOURS', '10am-6pm, 7 days a week'); define('MP_ARTWORK_TEXT_COLOR', '#707070'); define('MP_ARTWORK_BRAND_COLOR', '#ef953e'); define('MP_ARTWORK_SECOND_BRAND_COLOR', '#753249'); define('MP_ARTWORK_THIRD_BRAND_COLOR', '#ea5455'); define('MP_ARTWORK_FOURTH_BRAND_COLOR', '#2e3f59'); } public function init() { /* * Set up the content width value based on the theme's design. * */ if (!isset($content_width)): $content_width = 770; endif; include_once( ABSPATH . 'wp-admin/includes/plugin.php' ); $this->theme_requires(); } /** * Artwork setup. * * Sets up theme defaults and registers the various WordPress features that * Artwork supports. * * @since Artwork 1.0 */ public function setup() { /* * This theme styles the visual editor to resemble the theme style, * specifically font, colors, icons, and column width. */ add_editor_style(); /* * Makes Artwork available for translation. * * Translations can be added to the /languages/ directory. * If you're building a theme based on Artwork, use a find and * replace to change 'Artwork' to the name of your theme in all * template files. */ load_theme_textdomain('artwork-lite', get_template_directory() . '/languages'); $locale = get_locale(); $locale_file = get_template_directory() . "/languages/$locale.php"; if (is_readable($locale_file)) { require_once( $locale_file ); } /* * Adds RSS feed links to
for posts and comments. */ add_theme_support('automatic-feed-links'); /* * Supporting title tag via add_theme_support (since WordPress 4.1) */ add_theme_support('title-tag'); /* * This theme supports a variety of post formats. */ add_theme_support('post-formats', array('aside', 'gallery', 'image', 'video', 'quote', 'audio', 'link', 'status',)); /* * This theme uses wp_nav_menu() in one location. */ register_nav_menus( array( 'primary' => __('Primary Menu', 'artwork-lite') )); /* * This theme uses its own gallery styles. */ add_filter('use_default_gallery_style', '__return_false'); $this->add_theme_image_sizes(); } /* * Add theme support post thumbnails. */ public function add_theme_image_sizes() { if (function_exists('add_theme_support')) { add_theme_support('post-thumbnails'); set_post_thumbnail_size(770, 578, true); } add_image_size($this->get_prefix() . 'thumb-large', 1600, 900, true); add_image_size($this->get_prefix() . 'thumb-large-blog', 1170, 543, true); add_image_size($this->get_prefix() . 'thumb-medium', 960, 640, true); } /* Return the Google font stylesheet URL, if available. * * The use of Open Sans by default is localized. * * @since 1.0.0 * @access public * @return void */ function load_google_fonts() { wp_register_style('JosefinSans', 'https://fonts.googleapis.com/css?family=Josefin+Sans:400,100,100italic,300,300italic,400italic,600,600italic,700italic,700'); wp_enqueue_style('JosefinSans'); wp_register_style('Niconne', 'https://fonts.googleapis.com/css?family=Niconne'); wp_enqueue_style('Niconne'); } /** * Enqueue scripts and styles for the front end. */ function scripts_styles() { /* * Adds JavaScript to pages with the comment form to support * sites with threaded comments (when in use). */ if (is_singular() && comments_open() && get_option('thread_comments')) wp_enqueue_script('comment-reply'); /* * Scripts for template masonry blog */ wp_enqueue_script('jquery.infinitescroll', get_template_directory_uri() . '/js/jquery.infinitescroll.min.js', array('jquery'), '2.1.0', true); wp_enqueue_script('superfish.min', get_template_directory_uri() . '/js/superfish.min.js', array('jquery'), '1.7.5', true); wp_enqueue_script('jquery-labelauty', get_template_directory_uri() . '/js/jquery-labelauty.min.js', array('jquery',), '1.1', true); wp_enqueue_script($this->get_prefix() . 'script', get_template_directory_uri() . '/js/artwork.min.js', array('jquery', 'superfish.min', 'jquery-labelauty', 'jquery.infinitescroll'), '1.0', true); $translation_array = array( 'url' => get_template_directory_uri() ); wp_localize_script($this->get_prefix() . 'script', 'template_directory_uri', $translation_array); /* * Loads Artwork Styles */ wp_enqueue_style('font-awesome', get_template_directory_uri() . '/css/font-awesome.min.css', array('bootstrap'), '4.3.0', 'all'); wp_enqueue_style('bootstrap', get_template_directory_uri() . '/css/bootstrap.min.css', array(), '3.3.5', 'all'); wp_enqueue_style($this->get_prefix() . 'main', get_template_directory_uri() . '/css/artwork-style.min.css', array('bootstrap', 'font-awesome'), '1.0', 'all'); if (is_plugin_active('motopress-content-editor/motopress-content-editor.php') || is_plugin_active('motopress-content-editor-lite/motopress-content-editor.php')) { wp_enqueue_style($this->get_prefix() . 'motopress', get_template_directory_uri() . '/css/artwork-motopress.min.css', array('bootstrap', 'font-awesome', $this->get_prefix() . 'main'), '1.0', 'all'); } if (is_plugin_active('woocommerce/woocommerce.php')) { wp_enqueue_style($this->get_prefix() . 'woocommerce', get_template_directory_uri() . '/css/artwork-woocommerce.min.css', array('bootstrap', 'font-awesome', $this->get_prefix() . 'main'), '1.0', 'all'); } if (is_plugin_active('bbpress/bbpress.php')) { wp_enqueue_style($this->get_prefix() . 'bbpress', get_template_directory_uri() . '/css/artwork-bbpress.min.css', array('bootstrap', 'font-awesome', $this->get_prefix() . 'main'), '1.0', 'all'); } if (is_rtl()) { wp_enqueue_style($this->get_prefix() . 'rtl', get_template_directory_uri() . '/css/artwork-rtl.min.css', array('bootstrap', 'font-awesome', $this->get_prefix() . 'main'), '1.0', 'all'); } /* * Loads our main stylesheet. */ wp_enqueue_style($this->get_prefix() . 'style', get_stylesheet_uri(), array(), '1.0'); } /** * Register widget areas. * * @since Artwork 1.0 * @access public * @return void */ function widgets_init() { register_sidebar(array( 'name' => __('Main Widget Area', 'artwork-lite'), 'id' => 'sidebar-1', 'description' => __('Appears on posts and pages in the sidebar.', 'artwork-lite'), 'before_widget' => '', 'before_title' => '