This file contains hidden or 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 | |
@ini_set( 'upload_max_size' , '128M' ); | |
@ini_set( 'post_max_size', '128M'); | |
@ini_set( 'max_execution_time', '300' ); |
This file contains hidden or 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
//URLBOX | |
function urlbox_url_generate($url, $options){ | |
$options['url'] = $url; | |
$options['url'] = preg_replace("(^https?://)", "", $options['url'] ); | |
$format = isset($options['format']) ? $options['format'] : 'png'; | |
unset($options['format']); | |
$_parts = []; | |
foreach ($options as $key => $values) { | |
$values = is_array($values) ? $values : [$values]; | |
foreach ($values as $value) { |
This file contains hidden or 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 | |
//Record user's last login to custom meta | |
add_action( 'wp_login', 'smartwp_capture_login_time', 10, 2 ); | |
function smartwp_capture_login_time( $user_login, $user ) { | |
update_user_meta( $user->ID, 'last_login', time() ); | |
} | |
//Register new custom column with last login time | |
add_filter( 'manage_users_columns', 'smartwp_user_last_login_column' ); |
This file contains hidden or 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 smartwp_defer_js_parsing( $url ){ | |
if(is_admin()) return $url; //Skip admin JS files | |
if(is_user_logged_in()) return $url; //Skip if user is logged in | |
if(false === strpos($url, '.js')) return $url; //If it's not a JS file skip | |
if(strpos($url, 'jquery.js')) return $url; //Don't defer jQuery | |
return str_replace(' src', ' defer src', $url); //defer JS file | |
} | |
add_filter( 'script_loader_tag', 'smartwp_defer_js_parsing', 10 ); |
This file contains hidden or 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 wp_smartwp_scripts_method() { | |
wp_enqueue_script( 'my-custom-script', get_stylesheet_directory_uri() . '/js/your_custom_script.js', array( 'jquery' ), true ); | |
} | |
add_action( 'wp_enqueue_scripts', 'wp_smartwp_scripts_method' ); |
This file contains hidden or 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 | |
//Disable automatic "Your Site Has Been Updated..." emails | |
add_filter( 'auto_core_update_send_email', 'smartwp_disable_core_update_emails', 10, 4 ); | |
function smartwp_disable_core_update_emails( $send, $type, $core_update, $result ) { | |
if ( !empty($type) && $type == 'success' ) { | |
return false; | |
} | |
return true; | |
} |
This file contains hidden or 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 | |
//Removes rel="noopener" from automatically being added to links in WordPress | |
add_filter( 'tiny_mce_before_init', 'smartwp_allow_unsafe_link_target' ); | |
function smartwp_allow_unsafe_link_target( $mceInit ) { | |
$mceInit['allow_unsafe_link_target'] = true; | |
return $mceInit; | |
} |
This file contains hidden or 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 | |
//Displays the featured image in a <img> tag resized to the 'large' thumbnail size (use this in a loop) | |
echo get_the_post_thumbnail( get_the_ID(), 'large' ); |
This file contains hidden or 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
memory_limit = 256M; |
This file contains hidden or 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 | |
define('WP_MEMORY_LIMIT', '256M'); |