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
server { | |
listen *:80; | |
listen 443 ssl; # managed by Certbot | |
ssl_certificate /etc/letsencrypt/live/dokhacphong.com/fullchain.pem; # managed by Certbot | |
ssl_certificate_key /etc/letsencrypt/live/dokhacphong.com/privkey.pem; # managed by Certbot | |
include /etc/letsencrypt/options-ssl-nginx.conf; # managed by Certbot | |
ssl_dhparam /etc/letsencrypt/ssl-dhparams.pem; # managed by Certbot | |
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_before_cart', 'cs_apply_matched_coupons' ); | |
function cs_apply_matched_coupons() { | |
global $woocommerce; | |
$coupon1 = 'coupon 1'; // your coupon code here | |
$coupon2 = 'coupon 2'; // your coupon code here | |
$coupon3 = 'coupon 3'; // your coupon code here | |
$coupon4 = 'coupon 4'; // your coupon code here |
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
Deploy Bedrock on CPANEL | |
1. Prepare database | |
# Requirement | |
+ Got the root folder of CPANEL !important | |
# Change url and DB by Migrate DB Pro | |
Go to Migrate DB Pro at *.dokhacphong.com | |
At Migrate Tab => Choose Export File | |
//phong.dokhacphong.com =======> //domain live site | |
/var/www/clients/client3/web144/web/phong-com/site/web ===========> ROOT_FOLDER + '/web' | |
Hit botton Export |
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 new user, new db and grant privilege | |
> CREATE USER 'phong'@'localhost' IDENTIFIED BY 'phong!'; | |
> CREATE DATABASE phong | |
> GRANT ALL PRIVILEGES ON phong.* TO 'phong'@'localhost'; | |
> FLUSH PRIVILEGES | |
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
sudo mysql -u phong -p phongdatabase < file.sql |
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
$data['args']['tax_query'] = [ | |
[ | |
'taxonomy' => 'brand', | |
'field' => 'id', | |
'terms' => get_field('brands', $id) | |
] | |
]; |
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 ABC\Controllers; | |
use Stem\Controllers\PageController; | |
use Stem\Core\Context; | |
use Stem\Core\Response; | |
use ABC\Traits\Content\HasContent; | |
use ABC\Traits\Content\HasContentInterface; | |
use ABC\Traits\Content\HasHero; | |
use ABC\Traits\Content\HasOptions; |
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 prefix_movie_rewrite_rule() { | |
add_rewrite_tag('%state_id%', '([A-Za-z0-9\-\_]+)'); | |
add_rewrite_tag('%state%', '([A-Za-z0-9\-\_]+)'); | |
add_rewrite_rule ( 'states/([A-Za-z0-9\-\_]+)/([A-Za-z0-9\-\_]+)', 'index.php? | |
state_id=$matches[1]&state=$matches[2]', 'top' ); | |
} | |
add_action( 'init', 'prefix_movie_rewrite_rule'); |
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
**GET Request using Guzzle** | |
If you look at the REQ|RES website they provided a few endpoints for ‘GET’ request. I will take the example of ‘LIST USERS’ endpoint. For getting users list, they ask to send a GET request to this endpoint | |
https://reqres.in/api/users?page=2. | |
<?php | |
require_once "vendor/autoload.php"; | |
use GuzzleHttp\Client; | |
$client = new Client([ |
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
Restart bitnami apache | |
`sudo /opt/bitnami/ctlscript.sh restart` |
OlderNewer