Skip to content

Instantly share code, notes, and snippets.

@ThomasLarge
ThomasLarge / .gitignore
Last active May 1, 2018 09:38
Git WP ignore
# ignore all files starting with .
.*
# track this file .gitignore (i.e. do NOT ignore it)
!.gitignore
# track .editorconfig file (i.e. do NOT ignore it)
!.editorconfig
# track readme.md in the root (i.e. do NOT ignore it)
@ThomasLarge
ThomasLarge / functions.php
Last active May 1, 2018 09:38
WP Standard Functions
// Add SVG to media libary upload
function cc_mime_types($mimes) {
$mimes['svg'] = 'image/svg+xml';
return $mimes;
}
add_filter('upload_mimes', 'cc_mime_types');
@ThomasLarge
ThomasLarge / wp-config.php
Created October 30, 2017 15:54
WP Config
/** Wordpress memory limit. */
define('WP_MEMORY_LIMIT', '128M');
/* Hides all updates to the core and plugins : Change to false to update */
define('DISALLOW_FILE_MODS',true);
// Only allow 5 post revisons
define('WP_POST_REVISIONS', 5); // Change to false if you don't want any to save
// Empty trash after 7 days
@ThomasLarge
ThomasLarge / .htaccess
Last active May 1, 2018 09:38
.htaccess
# HTTPS wordpress rewrite
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /
RewriteCond %{ENV:HTTPS} !=on
RewriteRule ^.*$ https://%{SERVER_NAME}%{REQUEST_URI} [R,L]
@ThomasLarge
ThomasLarge / Fade-out-onscroll.js
Last active May 1, 2018 09:38
JQuery snippets
// Fade out on scroll
jQuery(window).scroll(function(){
jQuery(".fadeoutup").css("opacity", 1 - jQuery(window).scrollTop() / 550);
});
@ThomasLarge
ThomasLarge / Active-nav.php
Created October 30, 2017 16:41
WP snippets (HTML, inside theme)
<a class="<?php if (is_page('PAGE ID')) echo 'current_page_item'; ?>">LINK HERE</a>
@ThomasLarge
ThomasLarge / functions.php
Created October 30, 2017 17:31
WP Twitter
// twitter widget
if (function_exists('register_sidebar')) {
register_sidebar(array(
'name'=> 'Twitter',
'id' => 'twitter'
));
}
@ThomasLarge
ThomasLarge / theme-function.php
Last active May 1, 2018 09:37
WooCommeres Functions
// Woocommeres theme support
add_action( 'after_setup_theme', 'woocommerce_support' );
function woocommerce_support() {
add_theme_support( 'woocommerce' );
}
@ThomasLarge
ThomasLarge / woo-helpers.php
Last active May 1, 2018 09:37
WooCommeres Helpers
// Add a button when there is no price displayed - edit price.php
<p class="price"><?php echo $product->get_price_html(); ?></p> // Remove this and replace with
<p itemprop="price" class="price">
<?php
$price = $product->get_price_html();
if(empty($price))
{
@ThomasLarge
ThomasLarge / file.txt
Created November 8, 2017 08:33
Show / Hide hidden files mac
# hides the files
defaults write com.apple.finder AppleShowAllFiles NO
# Shows the files
defaults write com.apple.finder AppleShowAllFiles YES