Monday, 26 April 2021

wordpress remove quick edit custom post type


wordpress remove quick edit custom post type

It is safe to say that you are searching for an approach to eliminate the alter, view, rubbish, and fast alter joins that you see when you mouse over a post? While there's likely a module for this, we have made a fast code piece that you can use to eliminate alter, view, waste, and speedy alter joins inside posts administrator in WordPress.


add_filter( 'post_row_actions', 'remove_row_actions', 10, 1 );

function remove_row_actions( $actions )

{

    if( get_post_type() === 'post' )

        unset( $actions['edit'] );

        unset( $actions['view'] );

        unset( $actions['trash'] );

        unset( $actions['inline hide-if-no-js'] );

    return $actions;

}



Before



After




Wednesday, 21 April 2021

How to Change Default Media Upload Folder in WordPress?

 



Add the following lines in “wp-config.php” file and save your changes. The first line is a comment line for future reference.

/** Change Media Upload Directory */
define('UPLOADS', ".'media');

Tuesday, 20 April 2021

Add custom discount on subtotal in woocommerce by hook woocommerce_cart_calculate_fees

 





add_action( 'woocommerce_cart_calculate_fees', 'elex_discount_price' );

function elex_discount_price() 

    global $woocommerce; 

    $discount_price = 0; 

    foreach (WC()->cart->get_cart() as $cart_item_key => $values) {


        if(isset($values["custom_data"]) && $values["custom_data"] == "Free Product" && $values["quantity"] == 1){

            $discount_price = $values["line_total"];

        }

    }

    $woocommerce->cart->add_fee( 'Discounted Price', -$discount_price, true, 'standard' ); 


Add Custom link and content on fronted dashboard of buddypress

 





CUSTOM PROFILE TAB

function bp_custom_user_nav_item() {

    global $bp;

 

    $args = array(

            'name' => __('Portfolio', 'buddypress'),

            'slug' => 'portfolio',

            'default_subnav_slug' => 'portfolio',

            'position' => 50,

            'show_for_displayed_user' => false,

            'screen_function' => 'bp_custom_user_nav_item_screen',

            'item_css_id' => 'portfolio'

    );

 

    bp_core_new_nav_item( $args );

}

add_action( 'bp_setup_nav', 'bp_custom_user_nav_item', 99 );


SCREEN CALLBACK FUNCTION

function bp_custom_user_nav_item_screen() {

    add_action( 'bp_template_content', 'bp_custom_screen_content' );

    bp_core_load_template( apply_filters( 'bp_core_template_plugin', 'members/single/plugins' ) );

}



SCREEN CONTENT FUNCTION

function bp_custom_screen_content() {

 

   echo 'the custom content. 

    You can put a post loop here, 

    pass $user_id with bp_displayed_user_id()';

 

}