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
// DIY Popular Posts @ https://digwp.com/2016/03/diy-popular-posts/ | |
function shapeSpace_popular_posts($post_id) { | |
$count_key = 'popular_posts'; | |
$count = get_post_meta($post_id, $count_key, true); | |
if ($count == '') { | |
$count = 0; | |
delete_post_meta($post_id, $count_key); | |
add_post_meta($post_id, $count_key, '0'); | |
} else { | |
$count++; |
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 woo_add_cart_fee() { | |
global $woocommerce; | |
if ( is_cart() ) { | |
$woocommerce->cart->add_fee( __('Custom', 'woocommerce'), 5 ); | |
} | |
} | |
add_action( 'woocommerce_before_cart_table', 'woo_add_cart_fee' ); |
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
/** | |
* Disable the emojis | |
*/ | |
function disable_emojis() { | |
remove_action( 'wp_head', 'print_emoji_detection_script', 7 ); | |
remove_action( 'admin_print_scripts', 'print_emoji_detection_script' ); | |
remove_action( 'wp_print_styles', 'print_emoji_styles' ); | |
remove_action( 'admin_print_styles', 'print_emoji_styles' ); | |
remove_filter( 'the_content_feed', 'wp_staticize_emoji' ); | |
remove_filter( 'comment_text_rss', 'wp_staticize_emoji' ); |
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
/** | |
* Disable embeds on init. | |
* | |
* - Removes the needed query vars. | |
* - Disables oEmbed discovery. | |
* - Completely removes the related JavaScript. | |
* | |
* @since 1.0.0 | |
*/ | |
function evolution_disable_embeds_init() { |
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('init', 'evolution_remheadlink'); | |
function evolution_remheadlink(){ | |
remove_action('wp_head', 'rsd_link'); | |
remove_action('wp_head', 'wp_generator'); | |
remove_action('wp_head', 'index_rel_link'); | |
remove_action('wp_head', 'wlwmanifest_link'); | |
remove_action('wp_head', 'feed_links', 2); | |
remove_action('wp_head', 'feed_links_extra', 3); | |
remove_action('wp_head', 'parent_post_rel_link', 10, 0); | |
remove_action('wp_head', 'start_post_rel_link', 10, 0); |
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 display the cheapest shipping rate | |
*/ | |
function my_only_show_cheapest_shipping_rate( $rates, $package ) { | |
$cheapest_method = ''; | |
// Loop through shipping rates | |
if ( is_array( $rates ) ) : | |
foreach ( $rates as $key => $rate ) : |
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
/* remove meta field */ | |
DELETE FROM wp_postmeta WHERE meta_key = 'YourMetaKey'; | |
/* batch deleted spam comments */ | |
DELETE FROM wp_comments WHERE wp_comments.comment_approved = 'spam'; | |
/* batch deleted all unapproved comments */ | |
DELETE FROM wp_comments WHERE comment_approved = 0; | |
/* disable comments on older posts */ |
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
//create a new role | |
function psp_add_project_management_role() { | |
add_role('psp_project_manager', | |
'Project Manager', | |
array( | |
'read' => true, | |
'edit_posts' => false, | |
'delete_posts' => false, | |
'publish_posts' => false, |
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
<IfModule mod_deflate.c> | |
# Compress all output labeled with one of the following MIME-types | |
# (for Apache versions below 2.3.7, you don't need to enable `mod_filter` | |
# and can remove the `<IfModule mod_filter.c>` and `</IfModule>` lines | |
# as `AddOutputFilterByType` is still in the core directives). | |
<IfModule mod_filter.c> | |
AddOutputFilterByType DEFLATE application/atom+xml \ | |
application/javascript \ | |
application/json \ |
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 | |
is_home() //Checks if the blog post index is being displayed. This may or may not be your home page as well. | |
is_front_page() //Checks if your home page is being displayed. This works whether your front page settings are set up to display blog posts (i.e. blog index) or a static page. | |
is_single() //Checks to see whether any type of single post is being displayed (excluding attachments). | |
is_attachment() //Checks if an attachment is displayed. |