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
<?php | |
// this snippet requires PHP 5.3+ | |
add_action( 'wp_enqueue_scripts', function() { | |
wp_register_style( 'atomic-blocks/ab-cta', '/path/to/atomic-blocks/css/ab-cta.css', array(), 1.0.0 ); | |
} ); | |
add_filter( 'render_block', function( $block_content, $block ) { | |
if ( 'atomic-blocks/ab-cta' === $block['blockName'] ) { | |
ob_start(); | |
wp_print_styles( $block['blockName'] ); |
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 genesis_truncate_phrase( $text, $max_characters ) { | |
if ( ! $max_characters ) { | |
return ''; | |
} | |
$text = trim( $text ); | |
if ( mb_strlen( $text ) > $max_characters ) { |
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
<?php | |
/* | |
Add back Schema.org/blogPosting microdata to post entries. | |
Replace all instances of "themedemo" with something unique to your site. | |
User input is required in the last function. Be sure to fill these fields in with your own information. | |
Instances where you need to fill in information will be marked with a comment that indicates so. | |
*/ |
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
<?php | |
function cb_fetch_feed( $url ) { | |
require_once( ABSPATH . WPINC . '/class-feed.php' ); | |
$feed = new SimplePie(); | |
$feed->set_sanitize_class( 'WP_SimplePie_Sanitize_KSES' ); | |
// We must manually overwrite $feed->sanitize because SimplePie's | |
// constructor sets it before we have a chance to set the sanitization class |
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
svn co url-of-svn-repo | |
cd trunk | |
rm -rvf * *.* .* | |
git clone git-repo.git | |
copy files: | |
package.json | |
Gruntfile.js | |
.gitignore | |
.gitattributes |
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
<?php | |
add_action( 'init', 'sample_remove_entry_meta', 11 ); | |
/** | |
* Remove entry meta for post types | |
* | |
* @link https://gist.github.com/nathanrice/03a5871e5e5a27f22747 | |
*/ | |
function sample_remove_entry_meta() { | |
remove_post_type_support( 'post-type', 'genesis-entry-meta-before-content' ); |
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
/* ## Screen reader text | |
--------------------------------------------- */ | |
.screen-reader-text, | |
.screen-reader-text span, | |
.screen-reader-shortcut { | |
position: absolute !important; | |
clip: rect(0, 0, 0, 0); | |
height: 1px; | |
width: 1px; |
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 Accessibility support | |
add_theme_support( 'genesis-accessibility', array( 'headings', 'drop-down-menu', 'search-form', 'skip-links' ) ); |
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
<?php | |
//* Do NOT include the opening php tag | |
add_filter( 'stylesheet_uri', 'custom_replace_default_style_sheet', 10, 2 ); | |
/** | |
* Replace main theme style sheet with custom one if viewing post in a particular category. | |
* | |
* Note: Replace X with the category ID you want to target. | |
*/ | |
function custom_replace_default_style_sheet( $stylesheet, $stylesheet_dir ) { |
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
<?php | |
class Fruit_List { | |
private $fruit = array(); | |
function __construct() { | |
$this->add_fruit( array( | |
1 => 'apple', | |
2 => 'orange', |
NewerOlder