This file contains hidden or 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
<?php | |
/* | |
* Examples to add custom classes to Genesis WordPress Framework Markup when using HTML5 output | |
*/ | |
add_action( 'genesis_setup', 'srf_add_cust_classes', 15 ); // Priority 15 ensures it runs after Genesis itself has setup. | |
function srf_add_cust_classes() { | |
add_filter( 'genesis_attr_site-inner', 'srf_attr_site_inner' ); | |
add_filter( 'genesis_attr_content-sidebar-wrap', 'srf_attr_content_sidebar_wrap' ); | |
add_filter( 'genesis_attr_content', 'srf_attr_content' ); | |
add_filter( 'genesis_attr_sidebar-primary', 'srf_attr_sidebar_primary' ); |
This file contains hidden or 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
<?php | |
/** | |
* Remove links/menus from the admin bar | |
* | |
* Comment out what you want to keep. | |
* | |
* @author Vajrasar Goswami ([email protected]) | |
* | |
* @see https://codex.wordpress.org/Class_Reference/WP_Admin_Bar |
This file contains hidden or 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
<?php //* Do not include opening php tag | |
/* | |
Add Conditional of where you want your custom Menu to show (insted of Primary) | |
*/ | |
add_action( 'genesis_header', 'sk_replace_menu_in_primary' ); | |
function sk_replace_menu_in_primary() { | |
if( is_page() ) { // Put your conditional here |
This file contains hidden or 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
<?php | |
$cat = get_query_var('cat'); | |
$category = get_category ($cat); | |
if(is_archive()) { | |
?> | |
<div id="bread-cat-list-archive"> | |
<h2><?php echo $category->name; ?></h2> |
This file contains hidden or 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
<?php | |
/* | |
This is what I wrote to achieve a pattern where Parent Category shows without count | |
and their respective Child categories shown with count. I am pretty sure that there is some neat | |
way to get this done, but I was not able to find that. Pls mention in comments if you knw any | |
other alternative approach. | |
Ex: | |
Parent |
This file contains hidden or 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
<?php | |
/* | |
Here we will find out the WIDTH of 'first' image occuring in our 'the_content' | |
*/ | |
/* | |
Step: 1 | |
Using the famous 'catch_that_image' snippet, we will fetch the url of first image | |
occuring in the content and will pass the same url while calling a function to find |
This file contains hidden or 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
// Use Gists to store code you would like to remember later on | |
console.log(window); // log the "window" object to the console |
This file contains hidden or 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 a CSS ID to main element | |
add_filter( 'genesis_attr_content', 'custom_attributes_content' ); | |
function custom_attributes_content( $attributes ) { | |
if ( is_home() || is_archive() ) { | |
$attributes['id'] = 'main-content-area'; | |
} | |
return $attributes; | |
} |