Skip to content

Instantly share code, notes, and snippets.

Avatar

Chris Field PittsburghChris

View GitHub Profile
View gist:32dfc5abdb51e0ef7414
// Wrap images with figure tag. Courtesy of Interconnectit http://interconnectit.com/2175/how-to-remove-p-tags-from-images-in-wordpress/
if( ! function_exists( 'reverie_img_unautop ' ) ) {
function reverie_img_unautop($pee) {
$pee = preg_replace('/<p>\\s*?(<a .*?><img.*?><\\/a>|<img.*?>)?\\s*<\\/p>/s', '<figure>$1</figure>', $pee);
return $pee;
} /* end reverie_img_unautop */
}
@PittsburghChris
PittsburghChris / index.html
Created Dec 10, 2013
Make an image a circle using css
View index.html
<div class="round-image"><img src="" alt=""></div>
@PittsburghChris
PittsburghChris / functions.php
Created Dec 5, 2013
Make the add_image_size you've placed into functions.php available on the Admin side on the Media Library
View functions.php
add_filter( 'image_size_names_choose', 'my_custom_sizes' );
function my_custom_sizes( $sizes ) {
return array_merge( $sizes, array(
'your-custom-size' => __('Your Custom Size Name'),
) );
}
@PittsburghChris
PittsburghChris / functions.php
Last active Dec 29, 2015 — forked from studiopress/functions.php
How to add Google Fonts to an HTML5-compatible Genesis child theme after 2013.
View functions.php
<?php
//* Do NOT include the opening php tag
//* Enqueue Lato Google font
add_action( 'wp_enqueue_scripts', 'sp_load_google_fonts', 5);
function sp_load_google_fonts() {
wp_enqueue_style( 'google-font-lato', '//fonts.googleapis.com/css?family=Lato:300,700', array(), CHILD_THEME_VERSION );
}
View CTA-Widgets.php
/**
* Add CTA widget support for site. If widget not active, don't display
*
*/
function mp_cta_genesis() {
// Don't display the CTA on the home page, since it's built into the MP theme
if ( is_home() ) {
return;
}
@PittsburghChris
PittsburghChris / FiveBoxes
Created Sep 11, 2013
Genesis - adding slideshow widget area and 4 smaller widget areas
View FiveBoxes
/* Display Slideshow */
add_action( 'genesis_before_content', 'fiveBox_homepage_slideshow' );
/* Display Feature Boxes */
add_action( 'genesis_before_content', 'fiveBox_do_features' );
/* Function Slideshow */
function fiveBox_homepage_slideshow() {
echo '<div class="slideshow widget">';
dynamic_sidebar( 'homepage-slideshow' );
View header-url.php
<?php
//* Do NOT include the opening php tag
//* Modify the header URL
add_filter('genesis_seo_title', 'sp_seo_title', 10, 3);
function sp_seo_title($title, $inside, $wrap) {
$inside = sprintf( '<a href="http://www.yourdomain.com" title="%s">%s</a>', esc_attr( get_bloginfo('name') ), get_bloginfo('name') );
$title = sprintf('<%s id="title">%s</%s>', $wrap, $inside, $wrap);
return $title;
}
You can’t perform that action at this time.