Skip to content

Instantly share code, notes, and snippets.

@deeman
deeman / button-smart-history.html
Last active August 18, 2019 13:28
Smart button - Back to history button
<!-- Button history function, lets visitor click back to previous visited page -->
<button type="button" onclick="history.back();"> Back </button>
@deeman
deeman / mod_deflate_activate.txt
Last active August 18, 2019 12:59
.htaccess | Activate mod_deflate
#Activate support for "mod_deflate".
<IfModule mod_deflate.c>
<FilesMatch "\\.(js|css|html|htm|php|xml)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
@deeman
deeman / functions.php
Created August 18, 2019 13:39
Smart History Button - WooCommerce Single Product Page
//History Button on WooCommerce Single Product Page
add_action( 'woocommerce_after_add_to_cart_button', 'my_function_sample', 10 );
function my_function_sample() {
global $product;
echo ' <button type="button" onclick="history.back();"> Go back </button> ';
}
//*Possible modifications
// Change: echo ' <button type="button" onclick="history.back();"> Go back </button> ';
@deeman
deeman / functions.php
Last active August 21, 2019 08:06
Genesis Framework: Remove or Change Footer Credentials
<?php
//* Do NOT include the opening php tag shown above. Copy the code shown below.
//* Change the footer text
add_filter('genesis_footer_creds_text', 'sp_footer_creds_filter');
function sp_footer_creds_filter( $creds ) {
$creds = '[footer_copyright] &middot; <a href="http://mydomain.com">My Custom Link</a> &middot; Built on the <a href="http://www.studiopress.com/themes/genesis" title="Genesis Framework">Genesis Framework</a>';
return $creds;
}
// OR
// *Remove the footer text
@deeman
deeman / functions.php
Last active December 8, 2019 17:50
Genesis Framework Full Width 404 Page
// 404 Full Width Page
add_action( 'get_header', 'custom_404_layout' );
function custom_404_layout() {
if ( ! is_404() ) {
return;
}
add_filter( 'genesis_pre_get_option_site_layout', '__genesis_return_full_width_content' );
}
@deeman
deeman / functions.php
Created August 24, 2019 15:17
WordPress Snippet: 404 Redirect To Any URL
add_action( 'template_redirect', 'redirect_404_to_any_url' );
function redirect_404_to_any_url() {
if ( is_404() ) :
wp_redirect( 'http://example.com/', 301 );
exit;
endif;
}
@deeman
deeman / functions.php
Created August 25, 2019 09:41
WordPress: How To Enquque script
//1. Add action
add_action( 'wp_enqueue_scripts', 'my_enquque_script' );
//2. Set function
//3. And Enquque
function my_enquque_script() {
wp_enqueue_script( 'my-script', get_stylesheet_directory_uri() . '/js/my_enquque_script.js', array( 'jquery' ), '1.0.0', true );
}
@deeman
deeman / functions.php
Created August 25, 2019 09:41
WordPress: How To Enquque script
//1. Add action
add_action( 'wp_enqueue_scripts', 'my_enquque_script' );
//2. Set function
//3. And Enquque
function my_enquque_script() {
wp_enqueue_script( 'my-script', get_stylesheet_directory_uri() . '/js/my_enquque_script.js', array( 'jquery' ), '1.0.0', true );
}
@deeman
deeman / style.css
Last active August 29, 2019 08:20
Genesis Framework: WooCommerce Uneven Column Fix
/*WOO PROD.ARHCIVE COLUMN FIX*/
.woocommerce ul.products {
justify-content: left;
}
@deeman
deeman / woo-meta-remove.php
Last active August 30, 2019 12:11
Genesis Framework: Customize the post meta function
// Customize the post meta
// Remove "Filled in"-text and "Tagged"-text
add_filter( 'genesis_post_meta', 'sp_post_meta_filter' );
function sp_post_meta_filter($post_meta) {
if ( !is_page() ) {
$post_meta = '[post_categories before=""] [post_tags before=""]';
return $post_meta;
}}