Skip to content

Instantly share code, notes, and snippets.

View davidperezgar's full-sized avatar

David Perez davidperezgar

View GitHub Profile
@davidperezgar
davidperezgar / functions.php
Created September 6, 2016 21:47
Remove a layout with the Genesis Framework.
<?php
//* Do NOT include the opening php tag
//* Remove content/sidebar layout
genesis_unregister_layout( 'content-sidebar' );
//* Remove sidebar/content layout
genesis_unregister_layout( 'sidebar-content' );
//* Remove content/sidebar/sidebar layout
@davidperezgar
davidperezgar / genesis-featured-image-home.php
Created September 6, 2016 21:42
Genesis Adds featured image to home
@davidperezgar
davidperezgar / genesis-wp-customize-loop.php
Created September 4, 2016 14:09
Genesis customize loop
//*Grid Posts
if(is_archive() ){
remove_action( 'genesis_sidebar', 'genesis_do_sidebar' );
}
add_action( 'genesis_before_entry', 'cmk_grid_posts' );
function cmk_grid_posts() {
global $wp_query;
if ( is_singular() || is_post_type_archive() ) {
return;
<?php
add_filter( 'pre_get_posts', 'be_archive_query' );
/**
* Archive Query
*
* Sets all archives to 27 per page
* @since 1.0.0
* @link http://www.billerickson.net/customize-the-wordpress-query/
*
<?php
/**
* Archive Post Class
* @since 1.0.0
*
* Breaks the posts into three columns
* @link http://www.billerickson.net/code/grid-loop-using-post-class
*
* @param array $classes
@davidperezgar
davidperezgar / filteradmin.php
Created August 18, 2016 07:10
Filter admin taxonomies for WordPress
function cmk_add_taxonomy_filters() {
global $typenow;
// an array of all the taxonomyies you want to display. Use the taxonomy name or slug
$taxonomies = array('tipo', 'ingredientes');
// must set this to the post type you want the filter(s) displayed on
if( $typenow == 'comidas' ){
@davidperezgar
davidperezgar / filter-pagebuilder-origin.php
Created August 17, 2016 21:45
quitar llamadas premium en page builder
// Remove references to SiteOrigin Premium
add_filter( 'siteorigin_premium_upgrade_teaser', '__return_false' );
// Hook in
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' );
// Our hooked in function - $fields is passed via the filter!
function custom_override_checkout_fields( $fields ) {
unset($fields['billing']['billing_company']);

unset($fields['shipping']['shipping_company']); 
return $fields;
}
@davidperezgar
davidperezgar / functions.php
Created July 23, 2016 07:27
Remove the entry meta in the entry header with the Genesis Framework.
<?php
//* Do NOT include the opening php tag
//* Remove the entry meta in the entry header
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_open', 5 );
remove_action( 'genesis_entry_header', 'genesis_post_info', 12 );
remove_action( 'genesis_entry_header', 'genesis_entry_header_markup_close', 15 );
@davidperezgar
davidperezgar / genesis-sitetitle-logo.php
Created July 22, 2016 21:38
Genesis snippet change Site title with logo
remove_action( 'genesis_site_title', 'genesis_seo_site_title' );
remove_action( 'genesis_site_description', 'genesis_seo_site_description' );
add_action( 'genesis_site_title', 'cmk_logo' );
function cmk_logo() { ?>
<a class="navbar-brand" title="<?php echo get_bloginfo('description'); ?>" href="<?php echo home_url(); ?>">
<img src="<?php echo esc_url( get_stylesheet_directory_uri() );?>/images/logo.png" class="img-responsive" alt="<?php bloginfo('description');?>" width="243" height="76"/>
</a>
<?php }