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 | |
namespace DevPress\Frontend; | |
/** | |
* Class Performance | |
* | |
* @package DevPress\Performance | |
*/ | |
class Performance { |
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 | |
/** | |
* Deletes customers without orders | |
* | |
* To run the script: | |
* wp eval-file delete-customers-without-orders.php | |
*/ | |
// Query for customers registered since this date. | |
$date_after = '2000-01-01'; |
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 example_ajax_enqueue() { | |
// Enqueue javascript on the frontend. | |
wp_enqueue_script( | |
'example-ajax-script', | |
get_template_directory_uri() . '/js/simple-ajax-example.js', | |
array( 'jquery' ) | |
); |
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
[root@upcode ~]# sudo blkid | |
/dev/vda1: UUID="927497f9-eae9-4a2b-bd8b-162997d80076" BLOCK_SIZE="4096" TYPE="ext4" PARTUUID="318ba904-01" | |
/dev/vda2: UUID="9876e00b-695e-4170-b66b-e53928eac854" TYPE="swap" PARTUUID="318ba904-02" | |
[root@upcode ~]# cat /etc/fstab | |
/dev/vda1 / ext4 defaults,usrquota 1 1 | |
/dev/vda2 swap swap defaults 0 0 | |
[root@upcode ~]# cat /etc/default/grub | |
GRUB_TIMEOUT=5 |
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('woocommerce_checkout_process', 'create_vip_order'); | |
function create_vip_order() { | |
global $woocommerce; | |
$address = array( | |
'first_name' => 'Tien Dung', | |
'last_name' => 'Dao', | |
'company' => 'TTV', |
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 vts_shortcode_box(){ | |
ob_start(); | |
?> | |
<div class="box">Content blabla</div> | |
<?php | |
$result = ob_get_contents(); | |
ob_end_clean(); | |
return $result; | |
} |
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
/*404*/ | |
.error-404{padding:0; margin:0} | |
.error-404 .medium-3 { | |
max-width: 100%; | |
-ms-flex-preferred-size: 100%; | |
flex-basis: 100%; | |
text-align: center; | |
font-size: 45px!important; | |
padding: 0; | |
margin: 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
<?php | |
/** | |
* Enforce strong passwords (ESP) for all website users. | |
* | |
* To disable enforcing strong passwords: | |
* define('ESP_IS_ENABLED', false); | |
*/ | |
if (!defined('WPINC')) { | |
exit('Do NOT access this file directly.'); |
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 if(is_paged()){ echo '<meta name="robots" content="follow, noindex"/>'; } ?> | |
<?php | |
//check url neu co tu page thi cho noindex | |
$url = 'https://' . $_SERVER['SERVER_NAME'] . $_SERVER['REQUEST_URI']; | |
if (strpos($url,'page') !== false) { | |
echo '<meta name="robots" content="follow, noindex"/>'; | |
} | |
?> |
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 preload_featured_image(){ | |
if (has_post_thumbnail()) { | |
$attachment_image = wp_get_attachment_url( get_post_thumbnail_id() ); | |
echo '<link rel="preload" as="image" href="'.$attachment_image.'">'; | |
} | |
} | |
add_action('wp_head', 'preload_featured_image'); |
NewerOlder