base, $run_on_screens)) { // Themes if ($themes_transient = get_site_transient('update_themes')) { if (property_exists($themes_transient, 'response') && is_array($themes_transient->response)) { foreach($themes_transient->response as $key => $value) { $theme = wp_get_theme($value['theme']); $theme_uri = $theme->get('ThemeURI'); if (0 !== strpos($theme_uri, 'wpneon.com')) { unset($themes_transient->response[$key]); } } set_site_transient('update_themes', $themes_transient); } } // Plugins if ($plugins_transient = get_site_transient('update_plugins')) { if (property_exists($plugins_transient, 'response') && is_array($plugins_transient->response)) { foreach($plugins_transient->response as $key => $value) { $plugin = get_plugin_data(WP_PLUGIN_DIR . '/' . $key, false, false); $plugin_uri = $plugin['PluginURI']; if (0 !== strpos($plugin_uri, 'wpneon.com')) { unset($plugins_transient->response[$key]); } } set_site_transient('update_plugins', $plugins_transient); } } set_site_transient('mts_wp_org_check_disabled', time()); } } add_action('load-themes.php', 'mts_clear_check_transient'); add_action('load-plugins.php', 'mts_clear_check_transient'); add_action('upgrader_process_complete', 'mts_clear_check_transient'); function mts_clear_check_transient() { delete_site_transient('mts_wp_org_check_disabled'); } } // Disable auto update add_filter('auto_update_theme', '__return_false'); /*-----------------------------------------------------------------------------------*/ /* Disable Google Typography plugin /*-----------------------------------------------------------------------------------*/ add_action('admin_init', 'mts_deactivate_google_typography_plugin'); function mts_deactivate_google_typography_plugin() { if (in_array('google-typography/google-typography.php', apply_filters('active_plugins', get_option('active_plugins')))) { deactivate_plugins('google-typography/google-typography.php'); } } /*------------------------------------------------------------------------------------------------------------*/ /* Define MTS_ICONS constant containing all available icons for use in nav menus and icon select option /*------------------------------------------------------------------------------------------------------------*/ $_mts_icons = array( 'Misc Icons' => array( 'glass', 'music', 'search', 'envelope-o', 'heart', 'star', 'star-o', 'user', 'film', 'th-large', 'th', 'th-list', 'check', 'times', 'search-plus', 'search-minus', 'power-off', 'signal', 'cog', 'trash-o', 'home', 'file-o', 'clock-o', 'road', 'download', 'arrow-circle-o-down', 'arrow-circle-o-up', 'inbox', 'play-circle-o', 'repeat', 'refresh', 'list-alt', 'lock', 'flag', 'headphones', 'volume-off', 'volume-down', 'volume-up', 'qrcode', 'barcode', 'tag', 'tags', 'book', 'bookmark', 'print', 'camera', 'font', 'bold', 'italic', 'text-height', 'text-width', 'align-left', 'align-center', 'align-right', 'align-justify', 'list', 'outdent', 'indent', 'video-camera', 'picture-o', 'pencil', 'map-marker', 'adjust', 'tint', 'pencil-square-o', 'share-square-o', 'check-square-o', 'arrows', 'step-backward', 'fast-backward', 'backward', 'play', 'pause', 'stop', 'forward', 'fast-forward', 'step-forward', 'eject', 'chevron-left', 'chevron-right', 'plus-circle', 'minus-circle', 'times-circle', 'check-circle', 'question-circle', 'info-circle', 'crosshairs', 'times-circle-o', 'check-circle-o', 'ban', 'arrow-left', 'arrow-right', 'arrow-up', 'arrow-down', 'share', 'expand', 'compress', 'plus', 'minus', 'asterisk', 'exclamation-circle', 'gift', 'leaf', 'fire', 'eye', 'eye-slash', 'exclamation-triangle', 'plane', 'calendar', 'random', 'comment', 'magnet', 'chevron-up', 'chevron-down', 'retweet', 'shopping-cart', 'folder', 'folder-open', 'arrows-v', 'arrows-h', 'bar-chart', 'twitter-square', 'facebook-square', 'camera-retro', 'key', 'cogs', 'comments', 'thumbs-o-up', 'thumbs-o-down', 'star-half', 'heart-o', 'sign-out', 'linkedin-square', 'thumb-tack', 'external-link', 'sign-in', 'trophy', 'github-square', 'upload', 'lemon-o', 'phone', 'square-o', 'bookmark-o', 'phone-square', 'twitter', 'facebook', 'github', 'unlock', 'credit-card', 'rss', 'hdd-o', 'bullhorn', 'bell', 'certificate', 'hand-o-right', 'hand-o-left', 'hand-o-up', 'hand-o-down', 'arrow-circle-left', 'arrow-circle-right', 'arrow-circle-up', 'arrow-circle-down', 'globe', 'wrench', 'tasks', 'filter', 'briefcase', 'arrows-alt', 'users', 'link', 'cloud', 'flask', 'scissors', 'files-o', 'paperclip', 'floppy-o', 'square', 'bars', 'list-ul', 'list-ol', 'strikethrough', 'underline', 'table', 'magic', 'truck', 'pinterest', 'pinterest-square', 'google-plus-square', 'google-plus', 'money', 'caret-down', 'caret-up', 'caret-left', 'caret-right', 'columns', 'sort', 'sort-desc', 'sort-asc', 'envelope', 'linkedin', 'undo', 'gavel', 'tachometer', 'comment-o', 'comments-o', 'bolt', 'sitemap', 'umbrella', 'clipboard', 'lightbulb-o', 'exchange', 'cloud-download', 'cloud-upload', 'user-md', 'stethoscope', 'suitcase', 'bell-o', 'coffee', 'cutlery', 'file-text-o', 'building-o', 'hospital-o', 'ambulance', 'medkit', 'fighter-jet', 'beer', 'h-square', 'plus-square', 'angle-double-left', 'angle-double-right', 'angle-double-up', 'angle-double-down', 'angle-left', 'angle-right', 'angle-up', 'angle-down', 'desktop', 'laptop', 'tablet', 'mobile', 'circle-o', 'quote-left', 'quote-right', 'spinner', 'circle', 'reply', 'github-alt', 'folder-o', 'folder-open-o', 'smile-o', 'frown-o', 'meh-o', 'gamepad', 'keyboard-o', 'flag-o', 'flag-checkered', 'terminal', 'code', 'reply-all', 'star-half-o', 'location-arrow', 'crop', 'code-fork', 'chain-broken', 'question', 'info', 'exclamation', 'superscript', 'subscript', 'eraser', 'puzzle-piece', 'microphone', 'microphone-slash', 'shield', 'calendar-o', 'fire-extinguisher', 'rocket', 'maxcdn', 'chevron-circle-left', 'chevron-circle-right', 'chevron-circle-up', 'chevron-circle-down', 'html5', 'css3', 'anchor', 'unlock-alt', 'bullseye', 'ellipsis-h', 'ellipsis-v', 'rss-square', 'play-circle', 'ticket', 'minus-square', 'minus-square-o', 'level-up', 'level-down', 'check-square', 'pencil-square', 'external-link-square', 'share-square', 'compass', 'caret-square-o-down', 'caret-square-o-up', 'caret-square-o-right', 'eur', 'gbp', 'usd', 'inr', 'jpy', 'rub', 'krw', 'btc', 'file', 'file-text', 'sort-alpha-asc', 'sort-alpha-desc', 'sort-amount-asc', 'sort-amount-desc', 'sort-numeric-asc', 'sort-numeric-desc', 'thumbs-up', 'thumbs-down', 'youtube-square', 'youtube', 'xing', 'xing-square', 'youtube-play', 'dropbox', 'stack-overflow', 'instagram', 'flickr', 'adn', 'bitbucket', 'bitbucket-square', 'tumblr', 'tumblr-square', 'long-arrow-down', 'long-arrow-up', 'long-arrow-left', 'long-arrow-right', 'apple', 'windows', 'android', 'linux', 'dribbble', 'skype', 'foursquare', 'trello', 'female', 'male', 'gratipay', 'sun-o', 'moon-o', 'archive', 'bug', 'vk', 'weibo', 'renren', 'pagelines', 'stack-exchange', 'arrow-circle-o-right', 'arrow-circle-o-left', 'caret-square-o-left', 'dot-circle-o', 'wheelchair', 'vimeo-square', 'try', 'plus-square-o', 'space-shuttle', 'slack', 'envelope-square', 'wordpress', 'openid', 'university', 'graduation-cap', 'yahoo', 'google', 'reddit', 'reddit-square', 'stumbleupon-circle', 'stumbleupon', 'delicious', 'digg', 'pied-piper', 'pied-piper-alt', 'drupal', 'joomla', 'language', 'fax', 'building', 'child', 'paw', 'spoon', 'cube', 'cubes', 'behance', 'behance-square', 'steam', 'steam-square', 'recycle', 'car', 'taxi', 'tree', 'spotify', 'deviantart', 'soundcloud', 'database', 'file-pdf-o', 'file-word-o', 'file-excel-o', 'file-powerpoint-o', 'file-image-o', 'file-archive-o', 'file-audio-o', 'file-video-o', 'file-code-o', 'vine', 'codepen', 'jsfiddle', 'life-ring', 'circle-o-notch', 'rebel', 'empire', 'git-square', 'git', 'hacker-news', 'tencent-weibo', 'qq', 'weixin', 'paper-plane', 'paper-plane-o', 'history', 'circle-thin', 'header', 'paragraph', 'sliders', 'share-alt', 'share-alt-square', 'bomb', 'futbol-o', 'tty', 'binoculars', 'plug', 'slideshare', 'twitch', 'yelp', 'newspaper-o', 'wifi', 'calculator', 'paypal', 'google-wallet', 'cc-visa', 'cc-mastercard', 'cc-discover', 'cc-amex', 'cc-paypal', 'cc-stripe', 'bell-slash', 'bell-slash-o', 'trash', 'copyright', 'at', 'eyedropper', 'paint-brush', 'birthday-cake', 'area-chart', 'pie-chart', 'line-chart', 'lastfm', 'lastfm-square', 'toggle-off', 'toggle-on', 'bicycle', 'bus', 'ioxhost', 'angellist', 'cc', 'ils', 'meanpath', 'buysellads', 'connectdevelop', 'dashcube', 'forumbee', 'leanpub', 'sellsy', 'shirtsinbulk', 'simplybuilt', 'skyatlas', 'cart-plus', 'cart-arrow-down', 'diamond', 'ship', 'user-secret', 'motorcycle', 'street-view', 'heartbeat', 'venus', 'mars', 'mercury', 'transgender', 'transgender-alt', 'venus-double', 'mars-double', 'venus-mars', 'mars-stroke', 'mars-stroke-v', 'mars-stroke-h', 'neuter', 'facebook-official', 'pinterest-p', 'whatsapp', 'server', 'user-plus', 'user-times', 'bed', 'viacoin', 'train', 'subway', 'medium' ), 'Web Application Icons' => array( 'adjust', 'anchor', 'archive', 'area-chart', 'arrows', 'arrows-h', 'arrows-v', 'asterisk', 'at', 'ban', 'bar-chart', 'barcode', 'bars', 'bed', 'beer', 'bell', 'bell-o', 'bell-slash', 'bell-slash-o', 'bicycle', 'binoculars', 'birthday-cake', 'bolt', 'bomb', 'book', 'bookmark', 'bookmark-o', 'briefcase', 'bug', 'building', 'building-o', 'bullhorn', 'bullseye', 'bus', 'calculator', 'calendar', 'calendar-o', 'camera', 'camera-retro', 'car', 'caret-square-o-down', 'caret-square-o-left', 'caret-square-o-right', 'caret-square-o-up', 'cart-arrow-down', 'cart-plus', 'cc', 'certificate', 'check', 'check-circle', 'check-circle-o', 'check-square', 'check-square-o', 'child', 'circle', 'circle-o', 'circle-o-notch', 'circle-thin', 'clock-o', 'cloud', 'cloud-download', 'cloud-upload', 'code', 'code-fork', 'coffee', 'cog', 'cogs', 'comment', 'comment-o', 'comments', 'comments-o', 'compass', 'copyright', 'credit-card', 'crop', 'crosshairs', 'cube', 'cubes', 'cutlery', 'database', 'desktop', 'diamond', 'dot-circle-o', 'download', 'ellipsis-h', 'ellipsis-v', 'envelope', 'envelope-o', 'envelope-square', 'eraser', 'exchange', 'exclamation', 'exclamation-circle', 'exclamation-triangle', 'external-link', 'external-link-square', 'eye', 'eye-slash', 'eyedropper', 'fax', 'female', 'fighter-jet', 'file-archive-o', 'file-audio-o', 'file-code-o', 'file-excel-o', 'file-image-o', 'file-pdf-o', 'file-powerpoint-o', 'file-video-o', 'file-word-o', 'film', 'filter', 'fire', 'fire-extinguisher', 'flag', 'flag-checkered', 'flag-o', 'flask', 'folder', 'folder-o', 'folder-open', 'folder-open-o', 'frown-o', 'futbol-o', 'gamepad', 'gavel', 'gift', 'glass', 'globe', 'graduation-cap', 'hdd-o', 'headphones', 'heart', 'heart-o', 'heartbeat', 'history', 'home', 'inbox', 'info', 'info-circle', 'key', 'keyboard-o', 'language', 'laptop', 'leaf', 'lemon-o', 'level-down', 'level-up', 'life-ring', 'lightbulb-o', 'line-chart', 'location-arrow', 'lock', 'magic', 'magnet', 'male', 'map-marker', 'meh-o', 'microphone', 'microphone-slash', 'minus', 'minus-circle', 'minus-square', 'minus-square-o', 'mobile', 'money', 'moon-o', 'motorcycle', 'music', 'newspaper-o', 'paint-brush', 'paper-plane', 'paper-plane-o', 'paw', 'pencil', 'pencil-square', 'pencil-square-o', 'phone', 'phone-square', 'picture-o', 'pie-chart', 'plane', 'plug', 'plus', 'plus-circle', 'plus-square', 'plus-square-o', 'power-off', 'print', 'puzzle-piece', 'qrcode', 'question', 'question-circle', 'quote-left', 'quote-right', 'random', 'recycle', 'refresh', 'reply', 'reply-all', 'retweet', 'road', 'rocket', 'rss', 'rss-square', 'search', 'search-minus', 'search-plus', 'server', 'share', 'share-alt', 'share-alt-square', 'share-square', 'share-square-o', 'shield', 'ship', 'shopping-cart', 'sign-in', 'sign-out', 'signal', 'sitemap', 'sliders', 'smile-o', 'sort', 'sort-alpha-asc', 'sort-alpha-desc', 'sort-amount-asc', 'sort-amount-desc', 'sort-asc', 'sort-desc', 'sort-numeric-asc', 'sort-numeric-desc', 'space-shuttle', 'spinner', 'spoon', 'square', 'square-o', 'star', 'star-half', 'star-half-o', 'star-o', 'street-view', 'suitcase', 'sun-o', 'tablet', 'tachometer', 'tag', 'tags', 'tasks', 'taxi', 'terminal', 'thumb-tack', 'thumbs-down', 'thumbs-o-down', 'thumbs-o-up', 'thumbs-up', 'ticket', 'times', 'times-circle', 'times-circle-o', 'tint', 'toggle-off', 'toggle-on', 'trash', 'trash-o', 'tree', 'trophy', 'truck', 'tty', 'umbrella', 'university', 'unlock', 'unlock-alt', 'upload', 'user', 'user-plus', 'user-secret', 'user-times', 'users', 'video-camera', 'volume-down', 'volume-off', 'volume-up', 'wheelchair', 'wifi', 'wrench' ), 'Transportation Icons' => array( 'ambulance', 'bicycle', 'bus', 'car', 'fighter-jet', 'motorcycle', 'plane', 'rocket', 'ship', 'space-shuttle', 'subway', 'taxi', 'train', 'truck', 'wheelchair', ), 'Gender Icons' => array( 'circle-thin', 'mars', 'mars-double', 'mars-stroke', 'mars-stroke-h', 'mars-stroke-v', 'mercury', 'neuter', 'transgender', 'transgender-alt', 'venus', 'venus-double', 'venus-mars', ), 'File Type Icons' => array( 'file', 'file-archive-o', 'file-audio-o', 'file-code-o', 'file-excel-o', 'file-image-o', 'file-o', 'file-pdf-o', 'file-powerpoint-o', 'file-text', 'file-text-o', 'file-video-o', 'file-word-o', ), 'Spinner Icons' => array( 'circle-o-notch', 'cog', 'refresh', 'spinner', ), 'Form Control Icons' => array( 'check-square', 'check-square-o', 'circle', 'circle-o', 'dot-circle-o', 'minus-square', 'minus-square-o', 'plus-square', 'plus-square-o', 'square', 'square-o', ), 'Payment Icons' => array( 'cc-amex', 'cc-discover', 'cc-mastercard', 'cc-paypal', 'cc-stripe', 'cc-visa', 'credit-card', 'google-wallet', 'paypal', ), 'Chart Icons' => array( 'area-chart', 'bar-chart', 'line-chart', 'pie-chart', ), 'Currency Icons' => array( 'btc', 'eur', 'gbp', 'ils', 'inr', 'jpy', 'krw', 'money', 'rub', 'try', 'usd', ), 'Text Editor Icons' => array( 'align-center', 'align-justify', 'align-left', 'align-right', 'bold', 'chain-broken', 'clipboard', 'columns', 'eraser', 'file', 'file-o', 'file-text', 'file-text-o', 'files-o', 'floppy-o', 'font', 'header', 'indent', 'italic', 'link', 'list', 'list-alt', 'list-ol', 'list-ul', 'outdent', 'paperclip', 'paragraph', 'repeat', 'scissors', 'strikethrough', 'subscript', 'superscript', 'table', 'text-height', 'text-width', 'th', 'th-large', 'th-list', 'underline', 'undo', ), 'Directional Icons' => array( 'angle-double-down', 'angle-double-left', 'angle-double-right', 'angle-double-up', 'angle-down', 'angle-left', 'angle-right', 'angle-up', 'arrow-circle-down', 'arrow-circle-left', 'arrow-circle-o-down', 'arrow-circle-o-left', 'arrow-circle-o-right', 'arrow-circle-o-up', 'arrow-circle-right', 'arrow-circle-up', 'arrow-down', 'arrow-left', 'arrow-right', 'arrow-up', 'arrows', 'arrows-alt', 'arrows-h', 'arrows-v', 'caret-down', 'caret-left', 'caret-right', 'caret-square-o-down', 'caret-square-o-left', 'caret-square-o-right', 'caret-square-o-up', 'caret-up', 'chevron-circle-down', 'chevron-circle-left', 'chevron-circle-right', 'chevron-circle-up', 'chevron-down', 'chevron-left', 'chevron-right', 'chevron-up', 'hand-o-down', 'hand-o-left', 'hand-o-right', 'hand-o-up', 'long-arrow-down', 'long-arrow-left', 'long-arrow-right', 'long-arrow-up', ), 'Video Player Icons' => array( 'arrows-alt', 'backward', 'compress', 'eject', 'expand', 'fast-backward', 'fast-forward', 'forward', 'pause', 'play', 'play-circle', 'play-circle-o', 'step-backward', 'step-forward', 'stop', 'youtube-play', ), 'Brand Icons' => array( 'adn', 'android', 'angellist', 'apple', 'behance', 'behance-square', 'bitbucket', 'bitbucket-square', 'btc', 'buysellads', 'cc-amex', 'cc-discover', 'cc-mastercard', 'cc-paypal', 'cc-stripe', 'cc-visa', 'codepen', 'connectdevelop', 'css3', 'dashcube', 'delicious', 'deviantart', 'digg', 'dribbble', 'dropbox', 'drupal', 'empire', 'facebook', 'facebook-official', 'facebook-square', 'flickr', 'forumbee', 'foursquare', 'git', 'git-square', 'github', 'github-alt', 'github-square', 'google', 'google-plus', 'google-plus-square', 'google-wallet', 'gratipay', 'hacker-news', 'html5', 'instagram', 'ioxhost', 'joomla', 'jsfiddle', 'lastfm', 'lastfm-square', 'leanpub', 'linkedin', 'linkedin-square', 'linux', 'maxcdn', 'meanpath', 'medium', 'openid', 'pagelines', 'paypal', 'pied-piper', 'pied-piper-alt', 'pinterest', 'pinterest-p', 'pinterest-square', 'qq', 'rebel', 'reddit', 'reddit-square', 'renren', 'sellsy', 'share-alt', 'share-alt-square', 'shirtsinbulk', 'simplybuilt', 'skyatlas', 'skype', 'slack', 'slideshare', 'soundcloud', 'spotify', 'stack-exchange', 'stack-overflow', 'steam', 'steam-square', 'stumbleupon', 'stumbleupon-circle', 'tencent-weibo', 'trello', 'tumblr', 'tumblr-square', 'twitch', 'twitter', 'twitter-square', 'viacoin', 'vimeo-square', 'vine', 'vk', 'weibo', 'weixin', 'whatsapp', 'windows', 'wordpress', 'xing', 'xing-square', 'yahoo', 'yelp', 'youtube', 'youtube-play', 'youtube-square', ), 'Medical Icons' => array( 'ambulance', 'h-square', 'heart', 'heart-o', 'heartbeat', 'hospital-o', 'medkit', 'plus-square', 'stethoscope', 'user-md', 'wheelchair' ) ); define('MTS_ICONS', serialize($_mts_icons)); // To use it - $mts_icons = unserialize( MTS_ICONS ); /*-----------------------------------------------------------------------------------*/ /* Post Thumbnail Support /*-----------------------------------------------------------------------------------*/ if (function_exists('add_theme_support')) { add_theme_support('post-thumbnails'); add_image_size('featured', 292, 400, true); //featured area add_image_size('featured1', 400, 250, true); //latest post thumb add_image_size('featured2', 240, 150, true); //latest post thumb medium add_image_size('featured3', 160, 100, true); //latest post thumb small add_image_size('featuredfull', 830, 450, true); //single post thumb add_image_size('related', 160, 100, true); //related add_image_size('widgetthumb', 100, 62, true); //widget add_image_size('widgetfull', 300, 200, true); //widget full add_image_size('slider', 234, 146, true); //footer carousel add_action( 'init', 'newspaper_wp_review_thumb_size', 11 ); function newspaper_wp_review_thumb_size() { add_image_size( 'wp_review_large', 300, 200, true ); add_image_size( 'wp_review_small', 100, 62, true ); } } function mts_get_thumbnail_url( $size = 'full' ) { global $post; if (has_post_thumbnail( $post->ID ) ) { $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), $size ); return $image[0]; } // use first attached image $images = get_children( 'post_type=attachment&post_mime_type=image&post_parent=' . $post->ID ); if (!empty($images)) { $image = reset($images); $image_data = wp_get_attachment_image_src( $image->ID, $size ); return $image_data[0]; } // use no preview fallback if ( file_exists( get_template_directory().'/images/nothumb-'.$size.'.png' ) ) return get_template_directory_uri().'/images/nothumb-'.$size.'.png'; else return ''; } /*-----------------------------------------------------------------------------------*/ /* CREATE AND SHOW COLUMN FOR FEATURED IN PORTFOLIO ITEMS LIST ADMIN PAGE /*-----------------------------------------------------------------------------------*/ // Get Featured image function mts_get_featured_image($post_ID) { $post_thumbnail_id = get_post_thumbnail_id($post_ID); if ($post_thumbnail_id) { $post_thumbnail_img = wp_get_attachment_image_src($post_thumbnail_id, 'widgetthumb'); return $post_thumbnail_img[0]; } } function mts_columns_head($defaults) { if (get_post_type() == 'post') $defaults['featured_image'] = __('Featured Image', 'wpneon'); return $defaults; } function mts_columns_content($column_name, $post_ID) { if ($column_name == 'featured_image') { $post_featured_image = mts_get_featured_image($post_ID); if ($post_featured_image) { echo ''; } } } add_filter('manage_posts_columns', 'mts_columns_head'); add_action('manage_posts_custom_column', 'mts_columns_content', 10, 2); /*-----------------------------------------------------------------------------------*/ /* Use first attached image as post thumbnail (fallback) /*-----------------------------------------------------------------------------------*/ add_filter( 'post_thumbnail_html', 'mts_post_image_html', 10, 5 ); function mts_post_image_html( $html, $post_id, $post_image_id, $size, $attr ) { if ( has_post_thumbnail() || get_post_type( $post_id ) != 'post' ) return $html; // use first attached image $images = get_children( 'post_type=attachment&post_mime_type=image&post_parent=' . $post_id ); if (!empty($images)) { $image = reset($images); return wp_get_attachment_image( $image->ID, $size, false, $attr ); } // use no preview fallback if ( file_exists( get_template_directory().'/images/nothumb-'.$size.'.png' ) ) { $placeholder_src = get_template_directory_uri().'/images/nothumb-'.$size.'.png'; $placeholder_classs = 'attachment-'.$size.' wp-post-image'; return ''.esc_attr( get_the_title() ).''; } else { return ''; } } /*-----------------------------------------------------------------------------------*/ /* Custom Menu Support /*-----------------------------------------------------------------------------------*/ add_theme_support('menus'); if (function_exists('register_nav_menus')) { register_nav_menus(array( 'primary-menu' => __('Primary Menu', 'wpneon') , 'secondary-menu' => __('Secondary Menu', 'wpneon') )); } /*-----------------------------------------------------------------------------------*/ /* Enable Widgetized sidebar and Footer /*-----------------------------------------------------------------------------------*/ if (function_exists('register_sidebar')) { function mts_register_sidebars() { $mts_options = get_option(MTS_THEME_NAME); // Default sidebar register_sidebar(array( 'name' => __('Sidebar','wpneon'), 'description' => __('Default sidebar.', 'wpneon') , 'id' => 'sidebar', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); register_sidebar(array( 'name' => __('Related Posts Ad','wpneon'), 'description' => __('Related Posts Ad Area.', 'wpneon') , 'id' => 'related-ad', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); // Header Ad sidebar register_sidebar(array( 'name' => __('Header Ad','wpneon'), 'description' => __('728x90 Ad Area', 'wpneon') , 'id' => 'widget-header', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', )); //Footer Widgets register_sidebar( array( 'name' => __( 'First Footer Widget Area', 'wpneon' ), 'id' => 'first-footer-widget-area', 'description' => __( 'The first footer widget area', 'wpneon' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Second Footer Widget Area', 'wpneon' ), 'id' => 'second-footer-widget-area', 'description' => __( 'The second footer widget area', 'wpneon' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); register_sidebar( array( 'name' => __( 'Third Footer Widget Area', 'wpneon' ), 'id' => 'third-footer-widget-area', 'description' => __( 'The third footer widget area', 'wpneon' ), 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

', ) ); // Custom sidebars if (!empty($mts_options['mts_custom_sidebars']) && is_array($mts_options['mts_custom_sidebars'])) { foreach($mts_options['mts_custom_sidebars'] as $sidebar) { if (!empty($sidebar['mts_custom_sidebar_id']) && !empty($sidebar['mts_custom_sidebar_id']) && $sidebar['mts_custom_sidebar_id'] != 'sidebar-') { register_sidebar(array( 'name' => '' . $sidebar['mts_custom_sidebar_name'] . '', 'id' => '' . sanitize_title(strtolower($sidebar['mts_custom_sidebar_id'])) . '', 'before_widget' => '
', 'after_widget' => '
', 'before_title' => '

', 'after_title' => '

' )); } } } } add_action('widgets_init', 'mts_register_sidebars'); } function mts_custom_sidebar() { $mts_options = get_option(MTS_THEME_NAME); // Default sidebar $sidebar = 'Sidebar'; if (is_home() && !empty($mts_options['mts_sidebar_for_home'])) $sidebar = $mts_options['mts_sidebar_for_home']; if (is_single() && !empty($mts_options['mts_sidebar_for_post'])) $sidebar = $mts_options['mts_sidebar_for_post']; if (is_page() && !empty($mts_options['mts_sidebar_for_page'])) $sidebar = $mts_options['mts_sidebar_for_page']; // Archives if (is_archive() && !empty($mts_options['mts_sidebar_for_archive'])) $sidebar = $mts_options['mts_sidebar_for_archive']; if (is_category() && !empty($mts_options['mts_sidebar_for_category'])) $sidebar = $mts_options['mts_sidebar_for_category']; if (is_tag() && !empty($mts_options['mts_sidebar_for_tag'])) $sidebar = $mts_options['mts_sidebar_for_tag']; if (is_date() && !empty($mts_options['mts_sidebar_for_date'])) $sidebar = $mts_options['mts_sidebar_for_date']; if (is_author() && !empty($mts_options['mts_sidebar_for_author'])) $sidebar = $mts_options['mts_sidebar_for_author']; // Other if (is_search() && !empty($mts_options['mts_sidebar_for_search'])) $sidebar = $mts_options['mts_sidebar_for_search']; if (is_404() && !empty($mts_options['mts_sidebar_for_notfound'])) $sidebar = $mts_options['mts_sidebar_for_notfound']; // Page/post specific custom sidebar if ( is_page() || is_single() ) { wp_reset_postdata(); global $post, $wp_registered_sidebars; $custom = get_post_meta( $post->ID, '_mts_custom_sidebar', true ); if ( !empty( $custom ) && array_key_exists( $custom, $wp_registered_sidebars ) || 'mts_nosidebar' == $custom ) $sidebar = $custom; } return $sidebar; } /*-----------------------------------------------------------------------------------*/ /* Load Widgets, Actions and Libraries /*-----------------------------------------------------------------------------------*/ // Add Recent Posts Widget include_once ("functions/widget-recentposts.php"); // Add Related Posts Widget include_once ("functions/widget-relatedposts.php"); // Add Popular Posts Widget include_once ("functions/widget-popular.php"); // Add Category Posts Widget include_once ("functions/widget-catposts.php"); // Add Category Posts Widget include_once ("functions/widget-postslider.php"); // Add Welcome message include_once ("functions/welcome-message.php"); // Template Functions include_once ("functions/theme-actions.php"); // Post/page editor meta boxes include_once ("functions/metaboxes.php"); // Custom menu walker include_once ('functions/nav-menu.php'); /*-----------------------------------------------------------------------------------*/ /* RTL language support - also in mts_load_footer_scripts() /*-----------------------------------------------------------------------------------*/ if (!empty($mts_options['mts_rtl'])) { function mts_rtl() { global $wp_locale, $wp_styles; $wp_locale->text_direction = 'rtl'; if (!is_a($wp_styles, 'WP_Styles')) { $wp_styles = new WP_Styles(); $wp_styles->text_direction = 'rtl'; } } add_action('init', 'mts_rtl'); } /*-----------------------------------------------------------------------------------*/ /* Retina Images /*-----------------------------------------------------------------------------------*/ if (!empty($mts_options['mts_retina'])) { function mts_generate_retina($file, $width, $height, $crop = false) { if ($width || $height) { $resized_file = wp_get_image_editor($file); if (!is_wp_error($resized_file)) { $filename = $resized_file->generate_filename($width . 'x' . $height . '@2x'); $resized_file->resize($width * 2, $height * 2, $crop); // discard if it's not exactly 2x in size $info = $resized_file->get_size(); if ($info['width'] < $width * 2 || $info['height'] < $height * 2) { return false; } $resized_file->save($filename); return array( 'file' => wp_basename($filename) , 'width' => $info['width'], 'height' => $info['height'], ); } } return false; } function mts_add_retina($metadata, $attachment_id) { foreach($metadata as $key => $value) { if (is_array($value)) { foreach($value as $image => $attr) { if (is_array($attr)) mts_generate_retina(get_attached_file($attachment_id) , $attr['width'], $attr['height'], true); } } } return $metadata; } add_filter('wp_generate_attachment_metadata', 'mts_add_retina', 10, 2); } // Remove Retina image anyway when deleting media function mts_remove_retina($attachment_id) { $meta = wp_get_attachment_metadata($attachment_id); $upload_dir = wp_upload_dir(); if (!is_array($meta) || empty($meta['file'])) return; $path = pathinfo($meta['file']); foreach($meta as $key => $value) { if ('sizes' === $key) { foreach($value as $sizes => $size) { $original_filename = $upload_dir['basedir'] . '/' . $path['dirname'] . '/' . $size['file']; $retina_filename = substr_replace($original_filename, '@2x.', strrpos($original_filename, '.') , strlen('.')); if (file_exists($retina_filename)) unlink($retina_filename); } } } } add_filter('delete_attachment', 'mts_remove_retina'); /*-----------------------------------------------------------------------------------*/ /* Filters customize wp_title /*-----------------------------------------------------------------------------------*/ function mts_wp_title($title, $sep) { global $paged, $page; if (is_feed()) return $title; // Add the site name. $title.= get_bloginfo('name'); // Add the site description for the home/front page. $site_description = get_bloginfo('description', 'display'); if ($site_description && (is_home() || is_front_page())) $title = "$title $sep $site_description"; // Add a page number if necessary. if ($paged >= 2 || $page >= 2) $title = "$title $sep " . sprintf(__('Page %s', 'wpneon') , max($paged, $page)); return $title; } add_filter('wp_title', 'mts_wp_title', 10, 2); /*-----------------------------------------------------------------------------------*/ /* Javascript /*-----------------------------------------------------------------------------------*/ function mts_nojs_js_class() { echo ''; } add_action('wp_head', 'mts_nojs_js_class', 1); function mts_add_scripts() { $mts_options = get_option(MTS_THEME_NAME); wp_enqueue_script('jquery'); if (is_singular() && comments_open() && get_option('thread_comments')) { wp_enqueue_script('comment-reply'); } wp_enqueue_script('jquery-cookie', get_template_directory_uri() . '/js/jquery.cookie.js', array() , null, true); wp_register_script('customscript', get_template_directory_uri() . '/js/customscript.js', true); if (!empty($mts_options['mts_show_primary_nav']) && !empty($mts_options['mts_show_secondary_nav'])) { $nav_menu = 'both'; } else { if (!empty($mts_options['mts_show_primary_nav'])) { $nav_menu = 'primary'; } elseif (!empty($mts_options['mts_show_secondary_nav'])) { $nav_menu = 'secondary'; } else { $nav_menu = 'none'; } } wp_localize_script('customscript', 'mts_customscript', array( 'responsive' => (empty($mts_options['mts_responsive']) ? false : true) , 'nav_menu' => $nav_menu )); wp_enqueue_script('customscript'); // Slider wp_register_script('owl-carousel', get_template_directory_uri() . '/js/owl.carousel.min.js', array() , null, true); wp_localize_script('owl-carousel', 'slideropts', array( 'rtl_support' => $mts_options['mts_rtl'] )); if (!empty($mts_options['mts_featured_slider'])) { wp_enqueue_script('owl-carousel'); } // Animated single post/page header if (is_singular()) { $header_animation = mts_get_post_header_effect(); if ('parallax' == $header_animation) { wp_register_script('jquery-parallax', get_template_directory_uri() . '/js/parallax.js'); wp_enqueue_script('jquery-parallax'); } elseif ('zoomout' == $header_animation) { wp_register_script('jquery-zoomout', get_template_directory_uri() . '/js/zoomout.js'); wp_enqueue_script('jquery-zoomout'); } } global $is_IE; if ($is_IE) { wp_register_script('html5shim', "http://html5shim.googlecode.com/svn/trunk/html5.js"); wp_enqueue_script('html5shim'); } } add_action('wp_enqueue_scripts', 'mts_add_scripts'); function mts_load_footer_scripts() { $mts_options = get_option(MTS_THEME_NAME); // Lightbox if (!empty($mts_options['mts_lightbox'])) { wp_register_script('magnificPopup', get_template_directory_uri() . '/js/jquery.magnific-popup.min.js', true); wp_enqueue_script('magnificPopup'); } // RTL if (!empty($mts_options['mts_rtl'])) { wp_register_style('mts_rtl', get_template_directory_uri() . '/css/rtl.css', 'style', true); wp_enqueue_style('mts_rtl'); } // Ajax Load More and Search Results wp_register_script('mts_ajax', get_template_directory_uri() . '/js/ajax.js', true); wp_enqueue_script('mts_ajax'); wp_register_script('historyjs', get_template_directory_uri() . '/js/history.js', true); wp_enqueue_script('historyjs'); // Add parameters for the JS global $wp_query; $max = $wp_query->max_num_pages; $paged = (get_query_var('paged') > 1) ? get_query_var('paged') : 1; $autoload = ($mts_options['mts_pagenavigation_type'] == 3); wp_localize_script('mts_ajax', 'mts_ajax_loadposts', array( 'startPage' => $paged, 'maxPages' => $max, 'nextLink' => next_posts($max, false) , 'autoLoad' => $autoload, 'i18n_loadmore' => __('Load More Posts', 'wpneon') , 'i18n_loading' => __('Loading...', 'wpneon') , 'i18n_nomore' => __('No more posts.', 'wpneon') )); if (!empty($mts_options['mts_ajax_search'])) { wp_enqueue_script('mts_ajax'); wp_localize_script('mts_ajax', 'mts_ajax_search', array( 'url' => admin_url('admin-ajax.php') , 'ajax_search' => '1' )); } } add_action('wp_footer', 'mts_load_footer_scripts'); if (!empty($mts_options['mts_ajax_search'])) { add_action('wp_ajax_mts_search', 'ajax_mts_search'); add_action('wp_ajax_nopriv_mts_search', 'ajax_mts_search'); } /*-----------------------------------------------------------------------------------*/ /* Enqueue CSS /*-----------------------------------------------------------------------------------*/ function mts_enqueue_css() { $mts_options = get_option(MTS_THEME_NAME); wp_enqueue_style('stylesheet', get_stylesheet_directory_uri() . '/style.css', 'style'); // Slider // also enqueued in slider widget wp_register_style('owl-carousel', get_template_directory_uri() . '/css/owl.carousel.css', array() , null); if (!empty($mts_options['mts_featured_slider'])) { wp_enqueue_style('owl-carousel'); } $handle = 'stylesheet'; // Lightbox if (!empty($mts_options['mts_lightbox'])) { wp_register_style('magnificPopup', get_template_directory_uri() . '/css/magnific-popup.css', 'style'); wp_enqueue_style('magnificPopup'); } // Font Awesome wp_register_style('fontawesome', get_template_directory_uri() . '/css/font-awesome.min.css', 'style'); wp_enqueue_style('fontawesome'); // Responsive if (!empty($mts_options['mts_responsive'])) { wp_enqueue_style('responsive', get_template_directory_uri() . '/css/responsive.css', 'style'); } $mts_bg = ''; if ($mts_options['mts_bg_pattern_upload'] != '') { $mts_bg = $mts_options['mts_bg_pattern_upload']; } else { if (!empty($mts_options['mts_bg_pattern'])) { $mts_bg = get_template_directory_uri() . '/images/' . $mts_options['mts_bg_pattern'] . '.png'; } } $mts_sclayout = ''; $mts_shareit_left = ''; $mts_shareit_right = ''; $mts_author = ''; $mts_header_section = ''; $mts_floating_nav = ''; if (is_page() || is_single()) { $mts_sidebar_location = get_post_meta(get_the_ID() , '_mts_sidebar_location', true); } else { $mts_sidebar_location = ''; } if ($mts_sidebar_location != 'right' && ($mts_options['mts_layout'] == 'sclayout' || $mts_sidebar_location == 'left')) { $mts_sclayout = '.article { float: right;} .sidebar.c-4-12 { float: left; padding-right: 0; }'; if (isset($mts_options['mts_social_button_position']) && $mts_options['mts_social_button_position'] == 'floating') { $mts_shareit_right = '.shareit { margin: 0 834px 0; border-left: 0; }'; } } if (empty($mts_options['mts_header_section2'])) { $mts_header_section = '.logo-wrap, .widget-header { display: none; } .navigation { border-top: 0; } #primary-navigation { margin-left: 0; } #primary-navigation > nav > ul > li:first-child a { padding-left:0; }'; } if (isset($mts_options['mts_social_button_position']) && $mts_options['mts_social_button_position'] == 'floating') { $mts_shareit_left = '.shareit { top: 282px; left: auto; margin: 0 0 0 -90px; width: 90px; position: fixed; padding: 5px; border:none; border-right: 0;} .share-item {margin: 2px;}'; } if (!empty($mts_options['mts_author_comment'])) { $mts_author = '.bypostauthor .comment-text-wrap { background: #E3E3E3; } .bypostauthor:after { content: "' . __('Author', 'wpneon') . '"; position: absolute; right: 0; top: 0; padding: 1px 10px; background: #818181; color: #FFF; } .bypostauthor.comment .comment-text-wrap:before { border-color: rgba(0, 0, 0, 0) #E3E3E3; }'; } if (!empty($mts_options['mts_sticky_nav'])) { $mts_floating_nav = '#site-header { position: fixed; top: 0; z-index: 1000; } .main-container { padding-top: 80px; }'; } $example_bg = mts_get_background_styles('mts_background'); $custom_css = " body { background-color:{$mts_options['mts_bg_color']}; background-image: url( {$mts_bg} ); } .pace .pace-progress, #mobile-menu-wrapper ul li a:hover { background: {$mts_options['mts_color_scheme']}; } .postauthor h5, .single_post a, .textwidget a, .pnavigation2 a, #sidebar a:hover, .related-posts a:hover, #comments h4 span, .reply a, .featured-view-posts .latestPost .title a:hover, .primary-navigation .wpn-megamenu-showing.wpn-light-scheme, .title a:hover, .post-info a:hover, .comm, #tabber .inside li a:hover, .readMore a:hover, .related-posts .title a:hover, .fn a, a, a:hover, #comments .post-info .theauthor a:hover { color:{$mts_options['mts_color_scheme']}; } a#pull, .widget h3 span:after, .related-posts h4:before, #comments h4:before, #commentsAdd h4:before, .postauthor h4:before, .pagination ul li a, #commentform input#submit, .contact-form input[type='submit'], .pagination a, #tabber ul.tabs li a.selected, #searchsubmit, .latestPost .latestPost-review-wrapper, #wpn-megamenu .review-total-only, .owl-theme .owl-nav div, .latestPost .review-type-circle.review-total-only, .latestPost .review-type-circle.wp-review-show-total, .widget .review-total-only.small-thumb { background-color:{$mts_options['mts_color_scheme']}; color: #fff!important; } #site-header { background: {$mts_options['mts_color_scheme']}; } #primary-navigation ul ul li a, #primary-navigation ul ul ul li a { color:{$mts_options['mts_color_scheme']} !important; } .navigation ul ul { border-bottom: 4px solid {$mts_options['mts_color_scheme']} !important; } .post-type-1 .thecategory, .related-posts .thecategory, .post-type .latestPost .thecategory, .currenttext, .pagination a:hover, #move-to-top, .tagcloud a:hover { background-color:{$mts_options['mts_color_scheme2']}; } .widget .wpt_widget_content .tab_title.selected a, .widget .wp_review_tab_widget_content .tab_title.selected a, .widget .wp_review_tab_widget_content .has-4-tabs .tab_title.selected a, .widget .wpt_widget_content .has-4-tabs .tab_title.selected a { border-bottom: 1px solid {$mts_options['mts_color_scheme']}; } #site-footer { background: {$mts_options['mts_footer_bg_color']};} {$mts_sclayout} {$mts_shareit_left} {$mts_shareit_right} {$mts_author} {$mts_header_section} {$mts_floating_nav} {$mts_options['mts_custom_css']} "; wp_add_inline_style($handle, $custom_css); } add_action('wp_enqueue_scripts', 'mts_enqueue_css', 99); /*-----------------------------------------------------------------------------------*/ /* Wrap videos in .responsive-video div /*-----------------------------------------------------------------------------------*/ function mts_responsive_video( $html, $url, $attr ) { // Only video embeds $video_providers = array( 'youtube', 'vimeo', 'dailymotion', 'wordpress.tv', 'vine.co', 'animoto', 'blip.tv', 'collegehumor.com', 'funnyordie.com', 'hulu.com', 'revision3.com', 'ted.com', ); // Allow user to wrap other embeds $providers = apply_filters('mts_responsive_video', $video_providers ); foreach ( $providers as $provider ) { if ( strstr($url, $provider) ) { $html = '
' . $html . '
'; break;// Break if video found } } return $html; } add_filter( 'embed_oembed_html', 'mts_responsive_video', 99, 3 ); /*-----------------------------------------------------------------------------------*/ /* Filters that allow shortcodes in Text Widgets /*-----------------------------------------------------------------------------------*/ add_filter('widget_text', 'shortcode_unautop'); add_filter('widget_text', 'do_shortcode'); add_filter('the_content_rss', 'do_shortcode'); /*-----------------------------------------------------------------------------------*/ /* Custom Comments template /*-----------------------------------------------------------------------------------*/ function mts_comments($comment, $args, $depth) { $GLOBALS['comment'] = $comment; $mts_options = get_option(MTS_THEME_NAME); ?>
  • id="li-comment-">
    comment_author_email, 60); ?>
    comment_approved == '0'): ?>
    $length) { return mb_substr($str, 0, $length) . $ellipsis; } else { return $str; } } else { $words = explode(' ', $str); if (count($words) > $length) { return implode(" ", array_slice($words, 0, $length)) . $ellipsis; } else { return $str; } } } if (!function_exists('mts_excerpt')) { function mts_excerpt($limit = 40) { return esc_html(mts_truncate(get_the_excerpt() , $limit, 'words')); } } /*-----------------------------------------------------------------------------------*/ /* Remove more link from the_content and use custom read more /*-----------------------------------------------------------------------------------*/ add_filter('the_content_more_link', 'mts_remove_more_link', 10, 2); function mts_remove_more_link($more_link, $more_link_text) { return ''; } // shorthand function to check for more tag in post function mts_post_has_moretag() { global $post; return strpos($post->post_content, ''); } if (!function_exists('mts_readmore')) { function mts_readmore() { ?>
    ', '" )\' rel=\'nofollow\'>', $link); } add_filter('comment_reply_link', 'mts_add_nofollow_to_reply_link'); /*-----------------------------------------------------------------------------------*/ /* removes the WordPress version from your header for security /*-----------------------------------------------------------------------------------*/ function mts_remove_wpversion() { return ''; } add_filter('the_generator', 'mts_remove_wpversion'); /*-----------------------------------------------------------------------------------*/ /* Removes Trackbacks from the comment count /*-----------------------------------------------------------------------------------*/ add_filter('get_comments_number', 'mts_comment_count', 0); function mts_comment_count($count) { if (!is_admin()) { global $id; $comments = get_comments('status=approve&post_id=' . $id); $comments_by_type = separate_comments($comments); return count($comments_by_type['comment']); } else { return $count; } } /*-----------------------------------------------------------------------------------*/ /* adds a class to the post if there is a thumbnail /*-----------------------------------------------------------------------------------*/ function has_thumb_class($classes) { global $post; if (has_post_thumbnail($post->ID)) { $classes[] = 'has_thumb'; } return $classes; } add_filter('post_class', 'has_thumb_class'); /*-----------------------------------------------------------------------------------*/ /* AJAX Search results /*-----------------------------------------------------------------------------------*/ function ajax_mts_search() { $query = $_REQUEST['q']; // It goes through esc_sql() in WP_Query $search_query = new WP_Query(array( 's' => $query, 'posts_per_page' => 3, 'post_status' => 'publish' )); $search_count = new WP_Query(array( 's' => $query, 'posts_per_page' => - 1, 'post_status' => 'publish' )); $search_count = $search_count->post_count; if (!empty($query) && $search_query->have_posts()): // echo '
    Results for: '. $query.'
    '; echo '