This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
//* Add New Menu Navigation with dynamic child category walker class | |
add_action( 'genesis_after_header', 'webendev_subcat_navigation', 15 ); | |
function webendev_subcat_navigation() { | |
echo '<nav class="nav-primary">'; | |
wp_nav_menu( | |
array( | |
'container_class' => 'wrap', | |
'theme_location' => 'primary', | |
'menu_class' => 'menu genesis-nav-menu menu-secondary', | |
'walker' => new Submenu_Walker_Nav_Menu() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action('wp_loaded','webendev_register_nav_menu_class'); | |
/** | |
* New walker class to extend Walker_Nav_Menu | |
* Dynamically adds child categories to menu | |
* | |
*/ | |
function webendev_register_nav_menu_class(){ | |
class Submenu_Walker_Nav_Menu extends Walker_Nav_Menu { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'genesis_before_comments' , 'webendev_comment_count' ); | |
/** | |
* Add comment count and remove standard comment title | |
* | |
*/ | |
function webendev_comment_count () { | |
add_filter( 'genesis_title_comments', '_return_null' ); | |
if ( is_single() ) { | |
if ( have_comments() ) { | |
echo '<h3>'; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_action( 'wp_enqueue_scripts', 'webendev_load_font_awesome', 99 ); | |
/** | |
* Enqueue Font Awesome Stylesheet from MaxCDN | |
* | |
*/ | |
function webendev_load_font_awesome() { | |
if ( ! is_admin() ) { | |
wp_enqueue_style( 'font-awesome', '//netdna.bootstrapcdn.com/font-awesome/4.0.1/css/font-awesome.css', null, '4.0.1' ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Reduce database queries (http://www.catswhocode.com/blog/speeding-up-your-wordpress-blog-7-effective-solutions) | |
It is important to reduce unecessary queries to your database as each query take a few milliseconds to execute. First, you might want to know how many queries your blog execute in order to display a page. To do so, paste the code below in your functions.php file. Once done, just have a look to your site footer to know how many queries has been executed and how many time it took to completely load the page. | |
add_action( 'wp_footer', 'tcb_note_server_side_page_speed' ); | |
function tcb_note_server_side_page_speed() { | |
date_default_timezone_set( get_option( 'timezone_string' ) ); | |
$content = '[ ' . date( 'Y-m-d H:i:s T' ) . ' ] '; | |
$content .= 'Page created in '; | |
$content .= timer_stop( $display = 0, $precision = 2 ); | |
$content .= ' seconds from '; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'genesis_seo_title', 'webendev_add_logo_image_header', 10, 2 ); | |
/** | |
* Filter the genesis_seo_site_title to use an image for the logo instead of a background image. | |
* This will allow full width logos to be reponsive. Requires CSS header width of 100%, and | |
* no min-height in header. | |
* | |
*/ | |
function webendev_add_logo_image_header( $title, $inside ){ | |
$child_inside = sprintf( '<a href="%s" title="%s"><img src="'. get_stylesheet_directory_uri() .'/images/StreetSyleDogs_Logo_980x226.jpg" title="%s" alt="%s"/></a>', trailingslashit( home_url() ), esc_attr( get_bloginfo( 'name' ) ), esc_attr( get_bloginfo( 'name' ) ), esc_attr( get_bloginfo( 'name' ) ) ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'pre_get_posts', 'we_archive_query' ); | |
/** | |
* Category Query | |
* | |
* Sets all categories to 27 per page | |
* @since 1.0.0 | |
* @link http://www.billerickson.net/customize-the-wordpress-query/ | |
* | |
* @param object $query | |
*/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
add_filter( 'image_send_to_editor', 'we_insert_img_rel_attrib', 10, 6 ); | |
/** | |
* Add rel="prettyPhoto" attribute automatically as image is inserted into post | |
* Requires PrettyPhoto JS enqueue | |
*/ | |
function we_insert_img_rel_attrib( $html, $id, $caption, $title, $align, $url ) { | |
$rel = "<a rel=prettyPhoto"; | |
if ($url) {$html = str_replace("<a",$rel,$html);} | |
return $html; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function rkv_cacheless_css() { | |
wp_enqueue_style( 'MY-CSS-NAME', MY-CSS-FILE.CSS, array(), time(), 'all' ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// Remove the default Genesis child theme CSS | |
remove_action( 'genesis_meta', 'genesis_load_stylesheet' ); | |
add_action( 'wp_enqueue_scripts', 'prefix_load_stylesheet' ); | |
/** | |
* Get the time the theme's CSS was last modified | |
* and use it to bust the cache by appending | |
* it to the CSS output. | |
* | |
* @author FAT Media | |
* @link http://youneedfat.com |