Skip to content

Instantly share code, notes, and snippets.

@deeman
deeman / functions.php
Last active April 15, 2019 09:57
WooCommerce - Change number of Columns per row
/**
* Example: Change number or products per row to 4
*/
add_filter('loop_shop_columns', 'loop_columns', 999);
if (!function_exists('loop_columns')) {
function loop_columns() {
return 4; // 4 products per row
}
}
@deeman
deeman / functions.php
Last active April 11, 2019 11:47
Full Width Blog Banner
add_action( 'genesis_after_header', 'sk_blog_banner' );
/**
* Full Width Banner w. Image on Posts page
*/
function sk_blog_banner() {
if ( ! is_home() ) {
return;
} ?>
<div class="blog-banner">
@deeman
deeman / functions.php
Created April 8, 2019 08:11
Genesis Framework - Custom Footer
<?php
// Do NOT include the opening php tag.
// Remove site footer.
remove_action( 'genesis_footer', 'genesis_footer_markup_open', 5 );
remove_action( 'genesis_footer', 'genesis_do_footer' );
remove_action( 'genesis_footer', 'genesis_footer_markup_close', 15 );
// Customize site footer
add_action( 'genesis_footer', 'sp_custom_footer' );
function sp_custom_footer() { ?>
@deeman
deeman / functions.php
Created April 8, 2019 08:08
Genesis Framework - Register Newsletter Widget
<?php
// Do NOT include the opening php tag.
// Register Newsletter widget area.
genesis_register_sidebar( array(
'id' => 'newsletter',
'name' => __( 'Newsletter', 'theme-name' ),
'description' => __( 'Newsletter widget area.', 'theme-name' ),
) );
@deeman
deeman / functions.php
Created April 5, 2019 13:20
WooCommerce - Remove Marketplace Suggestions
add_filter( ‘woocommerce_allow_marketplace_suggestions’, ‘__return_false’ );
@deeman
deeman / genesis-woo-full-width.php
Created April 3, 2019 09:29
Genesis Framework - Full width on WooCommerce Pages
add_filter( 'genesis_pre_get_option_site_layout', 'change_layout_woocommerce');
function change_layout_woocommerce( $opt ) {
if ( ! class_exists( 'WooCommerce' ) )
return;
if (is_shop() ) {
$opt = 'full-width-content';
return $opt;
}
}
@deeman
deeman / functions.php
Created March 31, 2019 13:01
Remove Comment in WordPress via Functions
//remove comments from pages
add_action('init', 'remove_comment_support', 100);
function remove_comment_support() {
remove_post_type_support( 'page', 'comments' );
}
@deeman
deeman / single.php
Created March 31, 2019 13:00
Remove Single Page Comments in WordPress
<!-- Begin Comment
<?php comments_template(); ?>
End Comment -->
@deeman
deeman / page.php
Created March 31, 2019 12:59
Remove Page Comments in WordPress
<!-- Begin Comment
<?php comments_template( '', true ); ?>
End Comment -->
@deeman
deeman / genesis-words-counts-post.php
Created March 27, 2019 14:10
Genesis Framework - Display Word Count for Posts
//* WORD COUNT IN POSTS
add_shortcode( 'word_count', 'word_count' );
function word_count() {
return sprintf( __( '%s words', 'text-domain' ), str_word_count( strip_tags( get_post_field( 'post_content', get_the_ID() ) ), 0 ) );
}
add_filter( 'genesis_post_info', 'custom_post_info_filter' );
function custom_post_info_filter( $post_info ) {
if ( is_singular( 'post' ) ) {
$post_info = '[post_date] by [post_author_posts_link] [post_comments] [post_edit] [word_count]';