Skip to content

Instantly share code, notes, and snippets.

View atxiii's full-sized avatar
🐱
⛎ Miow

Hossein Shourabi atxiii

🐱
⛎ Miow
View GitHub Profile
@atxiii
atxiii / functions.php
Last active November 29, 2020 15:32
Adding Avatar Shortcode to WPBakery Page Builder Grid Builder
<?php
add_filter( 'vc_grid_item_shortcodes', 'my_module_add_grid_shortcodes' );
function my_module_add_grid_shortcodes( $shortcodes ) {
$shortcodes['vc_avatarino'] = array(
'name' => __( 'Avatar', 'mrcatdev' ),
'base' => 'vc_avatarino',
'category' => __( 'Content', 'mrcatdev' ),
'description' => __( 'Avatar', 'mrcatdev' ),
'post_type' => Vc_Grid_Item_Editor::postType(),
);
@atxiii
atxiii / delete_duplicate_wp_postmeta.sql
Last active November 25, 2020 16:44
Delete Duplicate postmeta in woocommerce by sql command.
create temporary table tmpTable (meta_id bigint);
Insert into tmpTable (meta_id)
select meta_id
from wp_postmeta pt
where exists
(
select *
from wp_postmeta pt2
@atxiii
atxiii / wp-cli-commands.sh
Last active February 9, 2022 14:37
WP-CLI Commands
# Delete all Woocomerce Order (CLI v2.3.0)
wp post delete $(wp post list --field=ID --post_type="shop_order") --force
# Import Data with skip authors
wp import orders.xml --authors=skip
# Export all post type with unlimite size
wp export --post_type=any --max_file_size=-1
@atxiii
atxiii / wp_users.sql
Last active November 2, 2020 16:35
Update Manually WP_USER AND WP_USERMETA
#WP_USERS
INSERT INTO `wp_users`(ID,user_login,user_pass,user_nicename,user_email,user_url,user_registered,user_activation_key,user_status,display_name) VALUES
(4,'aaa','$P$BmPs7v0824pjqq1bY7WZsKtl0qjw0x0','aa','daphne@aa.com','''','2019-07-01 03:45:13','''',0,'The aa') # yourdata
ON DUPLICATE KEY UPDATE
user_pass=VALUES(user_pass),
user_nicename=VALUES(user_nicename),
user_nicename=VALUES(user_nicename),
user_email=VALUES(user_email),
@atxiii
atxiii / _stock.sql
Created November 2, 2020 10:28
Update Product Stocks Woocommerce by SQL
INSERT INTO `wp_postmeta`(meta_id,post_id,meta_key,meta_value) VALUES
(24947,3352,'_stock',2),(24947,3352,'_stock',21)
ON DUPLICATE KEY UPDATE meta_value=VALUES(meta_value)
@atxiii
atxiii / add_woo_product_brand_to_additional_information_product_tab.php
Last active May 14, 2020 15:25
Add WooCommerce Brands logo with description to Additional Information product tab
<?php
// This code should be added to the functions.php file of the child theme
// Add WooCommerce Brands logo with description to Additional Information product tab
add_filter( 'woocommerce_product_tabs', 'woo_rename_tabs', 98 );
function woo_rename_tabs( $tabs ) {
global $product;
$tabs['additional_information']['callback'] = 'add_brand_to_info'; // this is the function name which is included below
return $tabs;
}
@atxiii
atxiii / Add_ACF_Content_to_WooCommerce_Description_Tab_on_Single_Products.php
Last active May 11, 2020 21:15
Add ACF content to WooCommerce Description Tab on Single Products
// Add content of Advance custom fields to description tab.
function add_acf_description_tab_content($data) {
woocommerce_product_description_tab();
echo '<hr>';
echo '<h3>Board Attributes</h3>';
$ba = get_field('board_attributes'); // ba = board_attribute => get field board_attribute from acf
$ba_items = [
// ['Attribute','value','image_url']
['Terrian',$ba['terrain'],$ba['terrain_thumbnail']],
@atxiii
atxiii / hammy-menu-svg-animation.markdown
Created May 9, 2020 06:25
Hammy menu / svg / animation
@atxiii
atxiii / font-awesome-4-7-for-select-html.markdown
Last active March 5, 2022 20:43
font awesome 4.7 for select html
@atxiii
atxiii / fa-aparat.markdown
Last active November 24, 2021 11:18
fa-aparat