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 November 7, 2016 17:17
Adds Excerpts to Pages in WordPress
add_action( 'init', ‘cmk_add_excerpts_to_pages' );
function cmk_add_excerpts_to_pages() {
add_post_type_support( 'page', 'excerpt' );
}
@davidperezgar
davidperezgar / functions.php
Created October 31, 2016 23:28 — forked from srikat/functions.php
Add Content below Title for Posts page inside div.posts-page-description in Genesis. https://sridharkatakam.com/adding-content-title-inside-div-posts-page-description-genesis/
// Bring back the missing editor for Posts page
add_action( 'edit_form_after_title', 'rgc_posts_page_edit_form' );
function rgc_posts_page_edit_form( $post ) {
$posts_page = get_option( 'page_for_posts' );
if ( $posts_page === $post->ID ) {
add_post_type_support( 'page', 'editor' );
}
@davidperezgar
davidperezgar / functions.php
Created October 31, 2016 23:28 — forked from srikat/functions.php
Horizontal Opt-in Form in Genesis using eNews Extended plugin and Flexbox. https://sridharkatakam.com/horizontal-opt-form-genesis-using-enews-extended-plugin-flexbox/
// Register Horizontal Opt-in widget area
genesis_register_widget_area(
array(
'id' => 'horizontal-opt-in',
'name' => __( 'Horizontal Opt-in', 'my-theme-text-domain' ),
'description' => __( 'This is the horizontal opt-in section.', 'my-theme-text-domain' ),
)
);
// Display Horizontal Opt-in widget area below header
@davidperezgar
davidperezgar / functions.php
Created October 21, 2016 11:11 — forked from fernandiez/functions.php
Taxonomy title and description (category, tag, taxonomy) in Genesis Child Theme
//* Adding WordPress Taxonomy title and description (category, tag, taxonomy)
add_action( 'genesis_before_loop', 'cmk_output_category_info' );
function cmk_output_category_info() {
if ( is_category() || is_tag() || is_tax() ) {
echo '<div class="archive-description">';
echo '<h1 class="archive-title">';
echo single_term_title();
@davidperezgar
davidperezgar / functions.php
Created October 21, 2016 10:47 — forked from billerickson/functions.php
Use the built-in post counter
<?php
/**
* Use the built-in post counter
*
* Sometimes you'll want to keep track of which post you're on in a loop.
* Some people create their own $loop_counter (ex: Genesis, https://gist.github.com/4675237 ).
* There's a better way! A loop counter is built into $wp_query. Ex:
*
* global $wp_query;
* echo $wp_query->current_post
@davidperezgar
davidperezgar / functions.php
Created October 20, 2016 16:30 — forked from jameskoster/functions.php
WooCommerce - change number of products displayed per page
// Display 24 products per page. Goes in functions.php
add_filter( 'loop_shop_per_page', create_function( '$cols', 'return 24;' ), 20 );
@davidperezgar
davidperezgar / functions.php
Created October 20, 2016 16:18
Remove price archive product woocommerce
// Remove prices
remove_action( 'woocommerce_after_shop_loop_item_title', 'woocommerce_template_loop_price', 10 );
@davidperezgar
davidperezgar / functions.php
Created October 20, 2016 16:05
Remove Showing count Woocommerce
// Removes showing results
 
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
@davidperezgar
davidperezgar / functions.php
Created October 20, 2016 16:05
Remove Showing count Woocommerce
// Removes showing results
 
remove_action( 'woocommerce_before_shop_loop', 'woocommerce_result_count', 20 );
@davidperezgar
davidperezgar / functions-short-description.php
Created October 18, 2016 11:28
Remove Short description and moves Description after title Woocommerce
//* Removes Short description and moves description tab to Short description location
//* Remove Short description Meta box
function remove_short_description() {
remove_meta_box( 'postexcerpt', 'product', 'normal');
}
add_action('add_meta_boxes', 'remove_short_description', 999);
//* Removes Short description from single product
remove_action( 'woocommerce_single_product_summary', 'woocommerce_template_single_excerpt', 20 );