Skip to content

Instantly share code, notes, and snippets.

add_action('genesis_before_sidebar_widget_area','rb_change_genesis_sidebar');
function rb_change_genesis_sidebar() {
if ( 'tribe_events' == get_post_type() ) {
remove_action( 'genesis_sidebar', 'ss_do_sidebar' ); // remove the Genesis simple sidebars sidebar (this is the one being used now, but if this plugin were deactivated...)
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' ); //remove the default genesis sidebar
add_action( 'genesis_sidebar', 'rb_do_sidebar' ); //add an action hook to call the function for my custom sidebar
}
}
//Function to output my custom sidebar
@lmartins
lmartins / genesis_attr_add_class.php
Last active September 20, 2022 13:33 — forked from JiveDig/genesis_attr_add_class.php
Add classes and attributes to any element in Genesis
<?php
//* Add class to .site-container
add_filter('genesis_attr_site-container', 'jive_attributes_st_container');
function jive_attributes_st_container($attributes) {
$attributes['class'] .= ' st-container';
return $attributes;
}
//* Add class to .site-inner
@secretstache
secretstache / admin-body-class-home.php
Last active August 29, 2015 14:13
Adds a unique body class to the editor screen of a specific page, in this case the home page
add_filter( 'admin_body_class', 'ssm_home_admin_body_class' );
/*
* Adds a body class to target the home page edit screen
*
*/
function ssm_home_admin_body_class( $classes ) {
global $post;
$screen = get_current_screen();
$homepage = get_page_by_title( 'Home' );
@kovshenin
kovshenin / meanwhile.php
Created April 27, 2015 16:18
meanwhile.php
<?php
add_filter( 'pre_comment_content', function( $content ) {
if ( strlen( $content ) > 64000 )
wp_die( 'Invalid comment.' );
return $content;
} );
@jb510
jb510 / meanwhile.php
Last active August 29, 2015 14:20 — forked from kovshenin/meanwhile.php
<?php
add_filter( 'pre_comment_content', 'jb_xss_comment_overflow_protection');
function jb_xss_comment_overflow_protection( $content ) {
if ( strlen( $content ) > 64000 ) {
wp_die( 'Invalid comment.' );
}
return $content;
}
@BurlesonBrad
BurlesonBrad / move-proceed-to-checkout
Created October 18, 2015 21:44
Get the friggin' Proceed To Checkout button to the TOP of the page (not the bottom!!)
add_action( 'woocommerce_before_cart', 'move_proceed_button' );
function move_proceed_button( $checkout ) {
echo '<a href="' . esc_url( WC()->cart->get_checkout_url() ) . '" class="checkout-button button alt wc-forward" >' . __( 'Proceed to Checkout', 'woocommerce' ) . '</a>';
}
@itzikbenh
itzikbenh / events_template.php
Last active January 9, 2020 20:35
Load WordPress posts via a custom API endpoint with pagination support.
<div class="posts-container">
<?php if ( $the_query->have_posts() ) : while ( $the_query->have_posts() ) : $the_query->the_post(); ?>
<div>
<?php
//Here we group events by event_date and put the date at the top.
$event_date = get_post_meta( $post->ID, 'event_date', true );
if ( $event_date != $date )
{
$event_date_formatted = date( 'l, F jS, Y', strtotime( $event_date ) );
echo "<p class='page-header'><strong>$event_date_formatted</strong></p>";