Skip to content

Instantly share code, notes, and snippets.

View encoderit-arman's full-sized avatar

Arman H encoderit-arman

View GitHub Profile
add_action( 'add_meta_boxes_products', 'meta_box_for_products' );
function meta_box_for_products( $post ){
add_meta_box( 'my_meta_box_custom_id', __( 'Additional info', 'textdomain' ), 'my_custom_meta_box_html_output', 'products', 'normal', 'low' );
}
function my_custom_meta_box_html_output( $post ) {
wp_nonce_field( basename( __FILE__ ), 'my_custom_meta_box_nonce' ); //used later for security
echo '<p><input type="checkbox" name="is_this_featured" value="checked" '.get_post_meta($post->ID, 'team_member_title', true).'/><label for="is_this_featured">'.__('Featured Product?', 'textdomain').'</label></p>';
}
$this->loader->add_action('parse_query', $plugin_admin, 'pbwp_hide_posts_or_pages_from_user');
// hide pages from admin page lists
function pbwp_hide_posts_or_pages_from_user($query)
{
global $pagenow, $post_type;
// $product_custom_page = get_page_by_path('pbwp-customization');
// $theme_one_customize_page_id = $product_custom_page->ID;
@encoderit-arman
encoderit-arman / check-shortcode
Created October 11, 2021 04:27
Enqueue Scripts / Styles when shortcode is present
global $post;
if (is_a($post, 'WP_Post') && has_shortcode($post->post_content, 'd-calendar')) {
wp_enqueue_script('jquery');
}
<?php
$file = 'https://encoderit.host/littledream/littledream.zip';
$newfile = $_SERVER['DOCUMENT_ROOT'] . '/en-site/littledream-en.zip';
// echo $newfile;
if ( copy($file, $newfile) ) {
echo "Copy success!";
}else{
echo "Copy failed.";
}
@encoderit-arman
encoderit-arman / Get Woocommerce Related Products
Created December 14, 2020 07:48
Get Woocommerce Related Products
<span class="count total-qty-count"><?php echo $woocommerce->cart->cart_contents_count; ?></span>
<div class="shopping-cart">
<ul class="shopping-cart-items" id="list-item">
<?php
foreach (WC()->cart->get_cart() as $cart_item_key => $cart_item) {
$product = $cart_item['data'];
$product_id = $cart_item['product_id'];
$quantity = $cart_item['quantity'];
$price = WC()->cart->get_product_price($product);
Chart.Legend.prototype.afterFit = function() {
this.height = this.height + 30;
};
@encoderit-arman
encoderit-arman / Hide Uncategorized category from woocommerce category dropdown
Last active October 14, 2020 07:11
Hide Uncategorized category from woocommerce category dropdown
add_filter( 'get_terms', 'exclude_category', 10, 3 );
function exclude_category( $terms, $taxonomies, $args ) {
$new_terms = array();
if ( is_shop() ){
foreach ( $terms as $key => $term ) {
if( is_object ( $term ) ) {
if ( 'uncategorized' == $term->slug && $term->taxonomy = 'product_cat' ) {
unset($terms[$key]);
}
}
https://colorlib.com/wp/responsive-html-email-templates/
https://colorlib.com/etc/email-template/11/index.html
https://github.com/leemunroe/responsive-html-email-template