Skip to content

Instantly share code, notes, and snippets.

@pasadamedia
pasadamedia / functions.php
Created November 28, 2014 06:35
Redirect WordPress register page to WooCommerce my-account page.
/**
* Redirect WordPress register page to WooCommerce my-account page.
*
*/
function pasada_wp_register_redirect() {
wp_redirect( home_url( '/my-account/' ) );
exit();
}
@pasadamedia
pasadamedia / functions.php
Created November 28, 2014 13:11
Remove and replace Google and iCal links on single event pages, with the link modified to open in new tab.
/**
* Remove and replace Google and iCal links on single event pages, with the link modified to open in new tab.
*
*/
remove_action( 'tribe_events_single_event_after_the_content', array( 'TribeiCal', 'single_event_links' ) );
add_action('tribe_events_single_event_after_the_content', 'tribe_add_cal_link');
function tribe_add_cal_link() {
@pasadamedia
pasadamedia / functions.php
Created November 28, 2014 12:23
Event featured image wrapped in a link to a larger version of the same image.
/**
* Event featured image wrapped in a link to a larger version of the same image.
*
* Replaces tribe_event_featured_image to enable link to a larger version for display in a lightbox.
* Called in custom single event template file (/pasada/tribe-events/single-event.php).
*
*/
function pasada_tribe_event_featured_image( $post_id = null, $size = 'full', $size2 = 'large', $link = true ) {
if ( is_null( $post_id ) ) {
$post_id = get_the_ID();
@pasadamedia
pasadamedia / functions.php
Created November 28, 2014 06:46
Remove allowed tags notice on comment form.
/**
* Remove allowed tags notice on comment form.
*
*/
function pasada_remove_comment_form_allowed_tags( $defaults ) {
$defaults['comment_notes_after'] = '';
return $defaults;
}
@pasadamedia
pasadamedia / functions.php
Created November 28, 2014 06:45
Customize Genesis footer credits.
/**
* Customize Genesis footer credits.
*
*/
function pasada_footer_creds_text() {
echo '<div class="creds"><p>&copy; Copyright ' . date('Y') . ' <a href="http://www.globalmindbody.org/" title="Global Mind Body" target="_blank">Global Mind Body</a> &middot;&nbsp;<a href="/contact/" title="Contact us">Contact</a>&nbsp;&middot;&nbsp;<a href="/privacy/" title="Privacy policy">Privacy</a>&nbsp;&middot;&nbsp;<a href="/terms/" title="Terms of use">Terms</a></p></div>';
}
add_filter( 'genesis_footer_creds_text', 'pasada_footer_creds_text' );
@pasadamedia
pasadamedia / functions.php
Created November 28, 2014 06:44
Modify display of post entries on Genesis blog and archive pages.
/**
* Modify display of post entries on Genesis blog and archive pages.
*
*/
function pasada_modify_entries() {
if ( is_home() || is_author() || is_category() || is_tag() || is_search() ) {
// Remove unwanted post elements.
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
@pasadamedia
pasadamedia / functions.php
Created November 28, 2014 06:43
Modify the post excerpt length.
/**
* Modify the post excerpt length (default is 55 words).
*
*/
function reduce_excerpt_length() {
return 30;
}
add_filter( 'excerpt_length', 'reduce_excerpt_length', 100 );
@pasadamedia
pasadamedia / functions.php
Created November 28, 2014 06:42
Change the "read more" link text on post excerpts
/**
* Change the "read more" link text on post excerpts to output this: … more »
*
*/
function custom_read_more_link() {
return '&hellip; <a class="more-link" href="' . get_permalink() . '" rel="nofollow">more&nbsp;&raquo;</a>';
}
add_filter( 'excerpt_more', 'custom_read_more_link' );
@pasadamedia
pasadamedia / functions.php
Created November 28, 2014 06:41
Change placeholder text in search box input field.
/**
* Change placeholder text in search box input field.
*
*/
function pasada_search_text( $text ) {
return esc_attr( 'Search this site' );
}
add_filter( 'genesis_search_text', 'pasada_search_text' );
@pasadamedia
pasadamedia / functions.php
Created November 28, 2014 06:41
Add custom body class on development site
/**
* Add custom body class on development site (use to display "beta" banner image in header, for example).
*
*/
function pasada_dev_body_class( $classes ) {
$server_ip = $_SERVER['SERVER_ADDR'];
if ( $server_ip === '127.0.0.1' ) {