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( 'woocommerce_single_product_summary', 'my_add_read_more_about_category', 25); | |
function my_add_read_more_about_category() | |
{ | |
global $product; | |
$cat_post_map = array( | |
// category id => array(<page id to link to>, <category plural label (optional)>) |
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
# Only database backup | |
declare -a SITES=('site1' 'site2' 'site3' 'site4'); | |
SITES_PATH_BASE=/var/www/ | |
SITES_PATH_SUFIX=/repo/public | |
SITES_BACKUP_FOLDER=backups | |
CURRENT_DATE=`date +%Y-%m-%d`; |
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
# This might ruin your database and I do not take any responsibility for that. Backup your database before continuing | |
! | |
# Check the results throughly | |
SELECT * FROM `wp_postmeta` | |
WHERE `meta_key` IN | |
( SELECT TRIM(LEADING '_' FROM `meta_key`) AS mk | |
FROM `wp_postmeta` | |
WHERE `meta_value` regexp '^field_[0-9a-f]+' | |
AND `meta_value` NOT IN |
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
// | |
// Improved and much cleaner version of https://gist.github.com/andyl/6360906 | |
// | |
// | |
// Bootstrap Mid-Small - col-ms-* - the missing grid set for Bootstrap3. | |
// | |
// This is a hack to fill the gap between 480 and 760 pixels - a missing range | |
// in the bootstrap responsive grid structure. Use these classes to style pages | |
// on cellphones when they transition from portrait to landscape. | |
// |
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 include_template( $template, $args = array() ) | |
{ | |
//Allow plugins to manipulate the tempalte data before sending it to the template | |
$data = apply_filters('prefix_template_data', $args, $template); | |
//Look in theme folder first, then plugin folder | |
if(locate_template($template) === '') | |
{ | |
include PREFIX_PLUGIN_PATH . 'templates/' . $template; |
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
# | |
set $skip_cache 0; | |
# POST requests and URL with a query string should always go to php | |
if ($request_method = POST) { | |
set $skip_cache 1; | |
} | |
if ($query_string != "") { |
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
add_action('wp', 'prefix_theme_setup', 99); | |
function prefix_theme_setup() | |
{ | |
add_filter( 'woocommerce_is_purchasable', 'prefix_is_purchasable', 20, 2); | |
} | |
function prefix_is_purchasable($purchasable, $product) |
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 | |
/** | |
* Gets the current global post type if one is set | |
*/ | |
function x_get_current_post_type() { | |
global $post, $typenow, $current_screen; | |
if( $post && $post->post_type ) | |
$post_type = $post->post_type; | |
elseif( $typenow ) |
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
SET FOREIGN_KEY_CHECKS = 0; | |
TRUNCATE TABLE `catalog_product_bundle_option`; | |
TRUNCATE TABLE `catalog_product_bundle_option_value`; | |
TRUNCATE TABLE `catalog_product_bundle_selection`; | |
TRUNCATE TABLE `catalog_product_entity_datetime`; | |
TRUNCATE TABLE `catalog_product_entity_decimal`; | |
TRUNCATE TABLE `catalog_product_entity_gallery`; |
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
add_filter('the_content', 'set_first_word_color', 10); | |
function set_first_word_color( $content ) | |
{ | |
$color = '#FF0000'; | |
$pos = strpos(ltrim($content), ' '); | |
$new_content = '<span style="color: '.$color.'"'.substr($content, 0, $pos).'</span>'.substr($content, $pos); |