Skip to content

Instantly share code, notes, and snippets.

@pasadamedia
pasadamedia / gist:c383671e0c086f3324fa
Last active August 29, 2015 14:10
Add this snippit to the functions.php of your Genesis child theme to change to full width page layout and remove the sidebar.
// Remove sidebar and add new body class to front page.
add_action ( 'get_header', 'pasada_full_width');
function pasada_full_width() {
if ( is_front_page() ) {
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
add_filter ( 'body_class', 'pasada_test' );
}
}
// Add body class.
@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 06:35
Remove WooCommerce breadcrumbs.
/**
* Remove WooCommerce breadcrumbs.
*
*/
function pasada_remove_wc_breadcrumbs() {
remove_action( 'woocommerce_before_main_content', 'woocommerce_breadcrumb', 20, 0 );
}
add_action( 'get_header', 'pasada_remove_wc_breadcrumbs' );
@pasadamedia
pasadamedia / functions.php
Created November 28, 2014 06:36
Order The Events Calendar events by post date (instead of event date) in the main blog loop.
/**
* Order The Events Calendar events by post date (instead of event date) in the main blog loop.
*
*/
function tribe_post_date_ordering( $query ) {
if ( $query->tribe_is_multi_posttype) {
remove_filter( 'posts_fields', array( 'TribeEventsQuery', 'multi_type_posts_fields' ) );
$query->set( 'order', 'DESC' );
@pasadamedia
pasadamedia / functions.php
Created November 28, 2014 06:37
Disable sidebar on WooCommerce login page.
/**
* Disable sidebar on WooCommerce login page.
*
*/
function pasada_wc_login_page_remove_sidebar() {
if ( is_account_page() && !is_user_logged_in() ) {
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
add_filter( 'body_class', 'pasada_full_width_page_body_class' );
@pasadamedia
pasadamedia / functions.php
Created November 28, 2014 06:39
Customize WordPress login page logo, link and title.
/**
* Replace default logo on WordPress login page with custom logo at /themename/images/logo-login.png.
*
*/
function pasada_login_logo() { ?>
<style type="text/css">
body.login div#login h1 a {
background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/images/logo-login.png);
}
@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' ) {
@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: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: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 );