Posts

Showing posts from August, 2022

Wordpress Mail Function

   $to = 'navototest@gmail.com'; $subject = 'The subject'; $body = 'The email body content'; $headers = array(      'From: Meirav Group <meiravgilboam@gilboam.co.il>',     'Content-Type: text/html; charset=UTF-8'     );   echo wp_mail( $to, $subject, $body, $headers ); die();

Disable Update Theme and plugin Wordpress

  define( 'WP_AUTO_UPDATE_CORE', false ); add_filter( 'auto_update_plugin', '__return_false' ); add_filter( 'auto_update_theme', '__return_false' );

Get Category, Child Category and category Image Word Press

 $args = array(         'hide_empty'        => true,         'parent'        => '0',         'meta_key'        => 'exwoofood_menu_order',         'orderby'        => 'meta_value_num',     ); $exwf_mngr = get_terms('product_cat', $args); foreach ($exwf_mngr as $key => $value) {     $args = array(     'hide_empty'   => true,     'parent' => $value->term_id );    ///  for child cat $termss = get_terms( 'product_cat', $args ); $termscat_chils = ''; foreach ($termss as $key => $tsvalue) {  $termscat_chils .=  $tsvalue->name.','; } $thumbnail_id = get_term_meta( $value->term_id, 'thumbnail_id', true ); if($thumbnail_id!=''){ // get the medium-sized image url $image = wp_get_attachment_image_src( $thumbnail_id, 'full' ); // O...

Disable Guttenburg editor wordpress

You need to put these code in your functions.php  // Disable Gutenberg From the back end. add_filter ( 'use_block_editor_for_post', '__return_false' ); // Disable Gutenberg From  widgets. add_filter ( 'use_widgets_blog_editor', '__return_false' ); add_action ( 'wp_enqueue_scripts', function() { // Remove CSS From  the front end. wp_dequeue_style ( 'wp-block-library' ); // Remove Gutenberg From theme. wp_dequeue_style ( 'wp-block-library-theme' ); // Remove inline global CSS From  the front end. wp_dequeue_style ( 'global-styles' ); }, 20 );

Create Custom Post Type wordpress

 function custom_post_type() {     // Set UI labels for Custom Post Type     $labels = [         'name' => _x('Deals', 'Post Type General Name', 'twentytwenty'),         'singular_name' => _x('Deal', 'Post Type Singular Name', 'twentytwenty'),         'menu_name' => __('Deals', 'twentytwenty'),         'parent_item_colon' => __('Parent Deal', 'twentytwenty'),         'all_items' => __('All Deals', 'twentytwenty'),         'view_item' => __('View Deal', 'twentytwenty'),         'add_new_item' => __('Add New Deal', 'twentytwenty'),         'add_new' => __('Add New', 'twentytwenty'),         'edit_item' => __('Edit Deal', 'twentytwenty'),         'update_item' => __('Update Deal', 'twentytwenty'),         ...

Remove css or js version wordpress

 // remove wp version number from scripts and styles function remove_css_js_version( $src ) {     if( strpos( $src, '?ver=' ) )         $src = remove_query_arg( 'ver', $src );     return $src; } add_filter( 'style_loader_src', 'remove_css_js_version', 9999 ); add_filter( 'script_loader_src', 'remove_css_js_version', 9999 );

Order cancel hook Woocommerce

Order Cancel Hook Woocommerce provide  woocommerce_order_status_cancelled hooke while order status changed to cancelled add_action( 'woocommerce_order_status_cancelled', 'change_status_to_cancelled_callback', 10, 1 ); public function change_status_to_cancelled_callback( $order_id ){     //Do Something here }

Add Custom Column To Custom Post Type

  For Adding Titles   manage_{$post_type}_posts_columns // Add the custom columns to the supplier post type: add_filter( 'manage_supplier_posts_columns', 'set_custom_edit_supplier_columns' ); function set_custom_edit_supplier_columns($columns) {    // unset( $columns['author'] );     $columns['website_url'] = __( 'Website URL', 'twentytwentytwo' );     $columns['mode_of_data_sync'] = __( 'Mode of data sync', 'twentytwentytwo' );     $columns['status'] = __( 'Status', 'twentytwentytwo' );     return $columns; } For Adding Columns data  manage_{$post_type}_posts_custom_column // Add the data to the custom columns for the supplier post type: add_action( 'manage_supplier_posts_custom_column' , 'custom_supplier_column', 10, 2 ); function custom_supplier_column( $column, $post_id ) {     switch ( $column ) {         case 'website_url' :             /*$terms = ...