Skip to content

Instantly share code, notes, and snippets.

View phamngsinh's full-sized avatar

Pham Ng Sinh phamngsinh

View GitHub Profile
@phamngsinh
phamngsinh / gist:d1d33801e72b76af47093fa38e3a5676
Created October 16, 2021 16:06
Nginx Installl Laravel in Wordpress
location /laravel {
alias /home/admin/web/wordpress/public_html/laravel/public;
try_files $uri $uri/ @nested;
location ~ \.php$ {
fastcgi_param SCRIPT_FILENAME $request_filename;
Ant Design
https://github.com/websemantics/awesome-ant-design
@phamngsinh
phamngsinh / gist:587e84c7bfb90e7f27984ca389e73830
Last active December 31, 2020 07:38
Find and Replace text in the entire table using a MySQL query
UPDATE table SET field = replace(field, text_needs_to_be_replaced, text_required);
https://smagic39.com
/*
* WP REST API version 2.0-beta7
* API base url ishttp://www.example.com/wp-json
*
* Reference
* https://developer.wordpress.org/rest-api/reference/media/
*
* Description
* an example of loading image to WordPress API using Guzzle
* inspired by s-hiroshi's gist at https://gist.github.com/s-hiroshi/3477e07454d809b9d38f
/*
* WP REST API version 2.0-beta7
* API base url ishttp://www.example.com/wp-json
*
* Reference
* https://wordpress.org/support/topic/new-post-with-image
*/
/*
* Get Guzzle HTTP Client. That client has been authenticated.
*/
First in app/etc/env.php we have to add "profiler" key in the connection array:
return array (
....
'db' =>
array (
.....
array (
'default' =>
array (
Autoprefixer
backrefs
Boxy Theme Addon - Font Face
CodeFormatter
GoSublime
JSLint
markupsafe
Materialize-White-Panels
mdpopups
Pretty JSON
https://www.youtube.com/watch?v=OjmZPPKaj6A
@phamngsinh
phamngsinh / gist:f892b3c25912d57b1ada9b1db17ec830
Created August 25, 2017 14:43
wordpress get children of category
/**
$term_id = 1;
$taxonomy_name = 'category';
$args = array( 'parent' => $term_id);
$termchildren = get_product_children($term_id, $taxonomy_name);
**/
function get_product_children( $term_id, $taxonomy ) {
if ( ! taxonomy_exists( $taxonomy ) ) {
return new WP_Error( 'invalid_taxonomy', __( 'Invalid taxonomy.' ) );
}
@phamngsinh
phamngsinh / wordress
Created August 11, 2017 02:07
WP Cli generate scaffold
Name Description
wp scaffold child-theme
Generate child theme based on an existing theme.
wp scaffold plugin
Generate starter code for a plugin.
wp scaffold plugin-tests
Generate files needed for running PHPUnit tests in a plugin.