This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# BEGIN WordPress | |
<IfModule mod_rewrite.c> | |
RewriteEngine On | |
RewriteBase / | |
RewriteCond %{REQUEST_FILENAME} !-f | |
RewriteCond %{HTTP_HOST} ^local.site\.com$ | |
RewriteRule ^wp-content/uploads/(.*)$ https://production.site.com/wp-content/uploads/$1 [NC,L] |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Add "first" and "last" CSS classes to dynamic sidebar widgets. Also adds numeric index class for each widget (widget-1, widget-2, etc.) | |
*/ | |
function hip_widget_first_last_classes( $params ) { | |
global $my_widget_num; // Global a counter array | |
$this_id = $params[0]['id']; // Get the id for the current sidebar we're processing | |
$arr_registered_widgets = wp_get_sidebars_widgets(); // Get an array of ALL registered widgets |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
class My_Widget extends WP_Widget { | |
public function __construct() { | |
$widget_ops = array( | |
'classname' => 'my-widget', | |
'description' => __( 'My Widget description', 'textdomain' ), | |
); | |
$this->WP_Widget( 'My_Widget', __( 'My Widget title', 'textdomain' ), $widget_ops ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
foreach ( $product_post_ids as $id ) { | |
| |
$product = wc_get_product( $id ); | |
| |
$product->set_stock_status( 'instock' ); | |
$product->set_manage_stock( 0 ); | |
$product->save(); | |
| |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
* Solution to order first by date, then by start time (both are meta values) | |
* http://wordpress.stackexchange.com/a/67391/5045 | |
* */ | |
add_action( 'pre_get_posts', 'pre_get_posts_programpunkter' ); | |
function pre_get_posts_programpunkter( $query ) { | |
if( !is_admin() && is_post_type_archive( 'programpunkt' ) && $query->is_main_query() ) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_print_scripts', 'dequeue_paupress_scripts', 99999 ); | |
function dequeue_paupress_scripts() { | |
if( is_admin() ) : | |
$current = get_current_screen(); | |
$allowed_screens = array( | |
'users', | |
'toplevel_page_paupress_options', |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function hip_filter_auto_update_email( $email ) { | |
$email['to'] = 'username@example.com'; | |
return $email; | |
} | |
add_filter( 'auto_core_update_email', 'hip_filter_auto_update_email', 1 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function getSimilarColor ( color ) { | |
var base_colors=["660000","990000","cc0000","cc3333","ea4c88","993399","663399","333399","0066cc","0099cc","66cccc","77cc33","669900","336600","666600","999900","cccc33","ffff00","ffcc33","ff9900","ff6600","cc6633","996633","663300","000000","999999","cccccc","ffffff"]; | |
//Convert to RGB, then R, G, B | |
var color_rgb = hex2rgb(color); | |
var color_r = color_rgb.split(',')[0]; | |
var color_g = color_rgb.split(',')[1]; | |
var color_b = color_rgb.split(',')[2]; | |
//Create an emtyp array for the difference betwwen the colors |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
function __construct() { | |
parent::__construct( awsAccessKey, awsSecretKey ); | |
$settings = get_option( 'op5dwnl_settings' ); | |
$this->buckets = ( isset( $settings['buckets'] ) ) ? $settings['buckets'] : false; | |
add_filter( 'acf/load_field/name=amazon_s3_file', array( $this, 'acf_load_field' ) ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Simply put the desired image size in the_post_thumbnail( $size ); | |
Sizes are declared as [height-in-pixels]x[width-in-pixels]. | |
Example: the_post_thumbnail('400x300'); | |
Dependencies: http://matthewruddy.github.io/Wordpress-Timthumb-alternative/ | |
*/ | |
add_filter( 'post_thumbnail_html', 'matthewruddy_post_thumbnail_resize', 20, 5 ); | |
function matthewruddy_post_thumbnail_resize( $html, $post_id, $post_thumbnail_id, $size, $attr ) { |