Skip to content

Instantly share code, notes, and snippets.

@deeman
deeman / functions.php
Created March 1, 2019 09:20
[WooCommerce] - Remove Sales Flash
//WOOCOMMERCE REMOVE SALES FLASH
remove_action( 'woocommerce_before_shop_loop_item_title', 'woocommerce_show_product_loop_sale_flash', 10 );
remove_action( 'woocommerce_before_single_product_summary', 'woocommerce_show_product_sale_flash', 10 );
@deeman
deeman / genesis-alignfull-wide.css
Last active April 23, 2019 07:22
Genesis - Adustments to CSS for Gutenberg
.entry-content .alignfull,
.entry-content .alignwide {
margin-left : calc( -100vw / 2 + 100% / 2 );
margin-right : calc( -100vw / 2 + 100% / 2 );
max-width : 100vw;
}
@deeman
deeman / enable HSTS
Last active March 18, 2019 10:34
[WordPress][Security] Enable HSTS - HTTP Strict Transport Security in .htaccess
<IfModule mod_headers.c>
Header set Strict-Transport-Security "max-age=63072000; includeSubDomains; preload"
</IfModule>
#Alternative
<IfModule mod_headers.c>
Header set Strict-Transport-Security "max-age=31536000" env=HTTPS
</IfModule>
@deeman
deeman / deny PHP uploads
Created March 18, 2019 10:32
[WordPress][Security] Deny PHP uploads
#Deny PHP uploads
#Create A .htaccess-file in dir /wp-content/uploads AND /wp-includes
#Copy/Paste code below and save:
<Files *.php>
deny from all
</Files>
@deeman
deeman / wordpress-disable-emojis
Created March 18, 2019 12:02
[WordPress] Disable Emoji's
/**
* Disable the emoji's
*/
function disable_emojis() {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'wp_print_styles', 'print_emoji_styles' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
remove_filter( 'the_content_feed', 'wp_staticize_emoji' );
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' );
@deeman
deeman / remove-emoji-support.php
Last active March 20, 2019 13:17
Remove/disable Emoji's in WordPress
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below into functions.php
/**
* Remove emoji support.
*/
function grd_remove_emoji() {
remove_action( 'wp_head', 'print_emoji_detection_script', 7 );
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' );
remove_action( 'admin_print_styles', 'print_emoji_styles' );
@deeman
deeman / remove-additional-css.php
Last active March 20, 2019 14:14
Remove Additional CSS Tab from WordPress Customizer
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below into functions.php
/**
* Remove the additional CSS section, introduced in 4.7, from the Customizer.
* @param $wp_customize WP_Customize_Manager
*/
add_action( 'customize_register', 'prefix_remove_css_section', 15 );
function prefix_remove_css_section( $wp_customize ) {
$wp_customize->remove_section( 'custom_css' );
@deeman
deeman / genesis-custom-header-logo.css
Last active March 27, 2019 13:50
Genesis Custom Header Logo
/*Default
.header-image .site-title a {
float: left;
min-height: 60px;
width: 100%;
}
*/
/* Example: Add some juice to your Child-Theme style.css*/
.header-image .site-title a {
min-height: 300px!important;
@deeman
deeman / genesis-before-comments.php
Created March 27, 2019 14:08
Genesis Framework - Move Comments Below Comment Form
//* Move Comments Below Comment Form
add_action( 'genesis_before_comments' , 'move_comments_below_form' );
function move_comments_below_form()
{
if ( is_single() && have_comments() ) {
remove_action( 'genesis_comment_form', 'genesis_do_comment_form' );
add_action( 'genesis_comments', 'genesis_do_comment_form', 5 );
}
}
@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]';