https://madebydenis.com/adding-google-fonts-to-your-wordpress-theme/
Category: Themes
Setting Up WP Customizer
https://madebydenis.com/setting-wordpress-customization-api-up/ Adding custom controls: https://madebydenis.com/adding-custom-controls-to-your-customization-api/
Registering/Enqueing Scripts in functions.php
if (!is_admin()) { wp_deregister_script(’jquery’); wp_register_script(’jquery’, ("http://ajax.googleapis.com/ajax/libs/jquery/1/jquery.min.js"), false); wp_enqueue_script(’jquery’); wp_register_script(’hoverIntent’, get_bloginfo(’template_directory’) . ‘/js/hoverIntent.js’, null, null, false); wp_enqueue_script(’hoverIntent’); wp_register_script(’superfish’, get_bloginfo(’template_directory’) . ‘/js/superfish.js’, null, null, false); wp_enqueue_script(’superfish’); wp_register_script(’slider’, get_bloginfo(’template_directory’) . ‘/js/slider.js’, null, null, false); wp_register_script(’cycle’, get_bloginfo(’template_directory’) . ‘/js/jquery.cycle.js’, null, null, false); } function pp_conditional_script_loading() { if ( is_home() || is_category(’900’) || is_page (’page-slug’ ) || is_post_type_archive(’post_type’)… Continue reading Registering/Enqueing Scripts in functions.php
Helpful Responsive Web Design Links
Converting WordPress to Be Mobile-Friendly Building a Mobile First Responsive WordPress Theme Responsive Design in 3 Steps How to Turn Any Site Into a Responsive Site Choosing Fonts for Your Mobile Website Super useful jQuery plugins for responsive web design Especially: Tinynav.js and jQuery Masonry
Automatically add classes to links generated by next_posts_link and previous_posts_link
add_filter(’next_posts_link_attributes’, ‘posts_link_attributes’); add_filter(’previous_posts_link_attributes’, ‘posts_link_attributes’); function posts_link_attributes() { return ‘class="myclass"’; }
Dynamic date for copyright notices
echo date(’Y’);
Sub-categories inherit the parent category template
function szub_cat_template_inherit() { if(is_category()) { global $wp_query; $category = $wp_query->get_queried_object(); if( $category->category_parent && file_exists(TEMPLATEPATH . ‘/category-‘ . $category->category_parent . ‘.php’) ) $template = TEMPLATEPATH . ‘/category-‘ . $category->category_parent . ‘.php’; elseif( file_exists(TEMPLATEPATH . "/category-" . get_query_var(’cat’) . ‘.php’) ) $template = TEMPLATEPATH . "/category-" . get_query_var(’cat’) . ‘.php’; elseif( file_exists(TEMPLATEPATH . "/category.php") )… Continue reading Sub-categories inherit the parent category template
Improved Excerpt
function improved_trim_excerpt( $text ) { if ( ” == $text ) { $permalink = get_permalink(); // my addition $text = get_the_content( ” ); $text = strip_shortcodes( $text ); $text = apply_filters( ‘the_content’, $text ); $text = preg_replace( ‘@<script[^>]*?> . *?</script>@si’, ”, $text ); $text = str_replace( ‘]]>’, ‘]]>’, $text ); $text = strip_tags( $text, ‘<b><em><i><p><strong><sub><sup><a>’… Continue reading Improved Excerpt
Exclude category from feed
Add to functions.php function myFeedExcluder($query) { if ($query->is_feed) { $query->set(’cat’,’-6’); } return $query; } add_filter(’pre_get_posts’,’myFeedExcluder’);
Exclude categories from index loop
<?php $posts=query_posts($query_string . ‘&cat=-6’); if (have_posts()) : while (have_posts()) : the_post(); ?>
Custom Taxonomies
Add to functions.php: add_action( ‘init’, ‘create_my_taxonomies’, 0 ); function create_my_taxonomies() { register_taxonomy( ‘ingredients’, ‘post’, array( ‘hierarchical’ => false, ‘label’ => ‘Ingredients’, ‘query_var’ => true, ‘rewrite’ => true ) ); }