Skip to content

Instantly share code, notes, and snippets.

Daniel Andersson deeman

Block or report user

Report or block deeman

Hide content and notifications from this user.

Learn more about blocking users

Contact Support about this user’s behavior.

Learn more about reporting abuse

Report abuse
View GitHub Profile
@deeman
deeman / functions.php
Last active Aug 21, 2019
Genesis Framework: Remove or Change Footer Credentials
View functions.php
<?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
Created Aug 18, 2019
Smart History Button - WooCommerce Single Product Page
View functions.php
//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 / mod_deflate_activate.txt
Last active Aug 18, 2019
.htaccess | Activate mod_deflate
View mod_deflate_activate.txt
#Activate support for "mod_deflate".
<IfModule mod_deflate.c>
<FilesMatch "\\.(js|css|html|htm|php|xml)$">
SetOutputFilter DEFLATE
</FilesMatch>
</IfModule>
@deeman
deeman / button-smart-history.html
Last active Aug 18, 2019
Smart button - Back to history button
View button-smart-history.html
<!-- Button history function, lets visitor click back to previous visited page -->
<button type="button" onclick="history.back();"> Back </button>
@deeman
deeman / functions.php
Created Aug 12, 2019
WooCommerce Gettext Translations
View functions.php
**
* Change text strings
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function my_text_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Sale!' :
$translated_text = __( 'Clearance!', 'woocommerce' );
break;
@deeman
deeman / functions.php
Created Aug 12, 2019
Rename Related Products Tab in WooCommerce
View functions.php
<?php
/**
* Change text strings
*
* @link http://codex.wordpress.org/Plugin_API/Filter_Reference/gettext
*/
function my_text_strings( $translated_text, $text, $domain ) {
switch ( $translated_text ) {
case 'Related Products' :
$translated_text = __( 'Your custom text here', 'woocommerce' );
@deeman
deeman / functions.php
Last active Aug 6, 2019
How to use Google Fonts in WordPress, the right way
View functions.php
//Better method regarding to the WordPress Codex
function my_google_fonts() {
if (!is_admin()) {
wp_register_style('google', 'https://fonts.googleapis.com/css?family=Roboto', array(), null, 'all');
wp_enqueue_style('google');
}}
add_action('wp_enqueue_scripts', 'my_google_fonts');
@deeman
deeman / functions.php
Last active Jul 29, 2019
Google Analytics tracking via Child Theme
View functions.php
function da_google_analytics() { ?>
<script async src="https://www.googletagmanager.com/gtag/js?id=UA-xxxxxxxxx-x">
</script>
<script>
//GA Script - Start. Paste your GA tracking script here
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA-xxxxxxxxx-x');
//GA Script - End
@deeman
deeman / functions.php
Created Jul 10, 2019
Genesis Framework: Breadcrumb reposition
View functions.php
//Breadcrumb reposition before content sidebar wrap
remove_action( 'genesis_before_loop', 'genesis_do_breadcrumbs' );
add_action( 'genesis_before_content_sidebar_wrap', 'genesis_do_breadcrumbs' );
@deeman
deeman / style.css
Created Jul 6, 2019
Better Helvetica- Stack
View style.css
body {
font-family: "HelveticaNeue-Light", "Helvetica Neue Light", "Helvetica Neue", Helvetica, Arial, "Lucida Grande", sans-serif;
font-weight: 300;
}
You can’t perform that action at this time.