', TP_AMP_Tags::get_amp_permalink()); endif; echo $echo; } add_action('wp_head', 'tp_head_add_tags'); // A better title // http://www.deluxeblogtips.com/2012/03/better-title-meta-tag.html function rw_title($title) { global $page, $paged; // Don't affect in feeds. if (is_feed()) return $title; $sep = ''; $seplocation = ''; // Add the blog's name if ('right' == $seplocation) { $title .= get_bloginfo('name'); } else { $title = get_bloginfo('name') . $title; } // Add the blog description for the home/front page. $site_description = get_bloginfo('description', 'display'); if ($site_description && (is_home() || is_front_page())) { $title .= " {$sep} {$site_description}"; } // Add a page number if necessary: if ($paged >= 2 || $page >= 2) { $title .= " {$sep} " . sprintf(__('Page %s', 'pjax-blog'), max($paged, $page)); } return $title; } // end better title // remove WP version from RSS function tp_rss_version() { return ''; } // remove WP version from scripts function tp_remove_wp_ver_css_js($src) { if (strpos($src, 'ver=')) $src = remove_query_arg('ver', $src); return $src; } // remove injected CSS for recent comments widget function tp_remove_wp_widget_recent_comments_style() { if (has_filter('wp_head', 'wp_widget_recent_comments_style')) { remove_filter('wp_head', 'wp_widget_recent_comments_style'); } } // remove injected CSS from recent comments widget function tp_remove_recent_comments_style() { global $wp_widget_factory; if (isset($wp_widget_factory->widgets['WP_Widget_Recent_Comments'])) { remove_action('wp_head', array($wp_widget_factory->widgets['WP_Widget_Recent_Comments'], 'recent_comments_style')); } } // remove injected CSS from gallery function tp_gallery_style($css) { return preg_replace("!!s", '', $css); } /********************* * SCRIPTS & ENQUEUEING *********************/ // loading modernizr and jquery, and reply script function tp_scripts_and_styles() { global $wp_styles; // call global $wp_styles variable to add conditional wrapper around ie stylesheet the WordPress way if (!is_admin()) { /** * enqueue js */ if (WP_DEBUG) { // sandbox wp_enqueue_script('modernizr', get_js_file('libs/modernizr.custom.min.js'), array(), '2.6.2', true); wp_enqueue_script('shave', get_js_file('libs/jquery.shave.min.js'), array('jquery'), '2.1.3', true); wp_enqueue_script('barbajs', get_js_file('libs/barba.min.js'), array(), '1.0.0', false); wp_enqueue_script('aos', get_js_file('libs/aos.min.js'), array(), '2.2.0', true); wp_enqueue_script('pagetransition', get_js_file('libs/pagetransitions.js'), array('jquery'), '1.0.0', true); // wp_enqueue_script('tween-max', '//cdnjs.cloudflare.com/ajax/libs/gsap/1.18.1/TweenMax.min.js', array(), '1.18.1', true); wp_enqueue_script('swiper', '//cdnjs.cloudflare.com/ajax/libs/Swiper/4.2.6/js/swiper.min.js', array(), '2.0.1', true); wp_enqueue_script('pjax-blog', get_js_file('scripts.js'), array('jquery', /*'tween-max',*/ 'shave', 'barbajs', 'pagetransition', 'aos', 'swiper'), '1.0.0', true); } else { // production // I wanted to concat all js files but Theme Check plugin gets error when trying to deregister core script, jquery. // wp_deregister_script('jquery'); wp_enqueue_script('pjax-blog', get_js_file('bundle.js'), array('jquery'), '1.0.0', '1.0.0', true); } /** * enqueue styles */ wp_enqueue_style('tp-stylesheet', get_css_file('style.css'), array(), '1.0.0', 'all'); wp_enqueue_style('tp-ie-only', get_css_file('ie.css'), array(), '1.0.0'); $wp_styles->add_data('tp-ie-only', 'conditional', 'lt IE 9'); // add conditional wrapper around ie stylesheet // comment reply script for threaded comments if (is_singular() AND comments_open() AND (get_option('thread_comments') == 1)) { wp_enqueue_script('comment-reply'); } } } function tp_admin_scripts_and_styles() { // admin and customizer preview styles wp_enqueue_style('wp-color-picker'); wp_enqueue_style('admin_css', get_css_file('admin.css'), false, '1.0.0'); // admin and customizer preview scripts wp_enqueue_script('wp-color-picker'); // only in preview if (is_customize_preview()) { wp_enqueue_script('alpha-color-picker', get_js_file('libs/alpha-color-picker.js'), array('jquery', 'wp-color-picker'), '1.0.0', true); // only in wp-admin } else { wp_enqueue_script('tp-admin-script', get_js_file('admin.js'), array('wp-color-picker', 'jquery', 'jquery-ui-dialog'), false, true); wp_enqueue_script('alpha-color-picker-admin', get_js_file('libs/alpha-color-picker-admin.js'), array('jquery', 'wp-color-picker'), '1.0.0', true); wp_enqueue_style ( 'wp-jquery-ui-dialog'); } } /********************* * GET ICOMOON FONT FACE *********************/ function get_icomoon_font_face() { $template_directory_uri = get_template_directory_uri(); ob_start(); ?> @font-face { font-family: "icomoon"; src: url("/library/fonts/icomoon/icomoon.eot"); src: url("/library/fonts/icomoon/icomoon.eot#iefix") format("embedded-opentype"), url("/library/fonts/icomoon/icomoon.ttf") format("truetype"), url("/library/fonts/icomoon/icomoon.woff") format("woff"), url("/library/fonts/icomoon/icomoon.svg#icomoon") format("svg"); font-weight: normal; font-style: normal; } %s', get_icomoon_font_face()); } add_action('wp_head', 'the_icomoon_font_face'); /********************* * SET CUSTOM FIELD TO TAX *********************/ function add_tp_custom_field_to_taxonomy() { // A callback function to add a custom field to our "colors" taxonomy function taxonomy_custom_fields($tag) { // Check for existing taxonomy meta for the term you're editing if (is_object($tag)) : $t_id = $tag->term_id; // Get the ID of the term you're editing $term_meta = get_option("taxonomy_term_$t_id"); // Do the check ?>