Skip to content

Instantly share code, notes, and snippets.

View devendrabisht's full-sized avatar
👨‍💻
Busy in developing status

Devendra Bisht devendrabisht

👨‍💻
Busy in developing status
View GitHub Profile
@devendrabisht
devendrabisht / devxwp-woo-customization.php
Created November 22, 2023 05:49
Forcefully show draft products on frontend - WooCommerce
function devxwp_show_draft_products_on_frontend( $query ) {
// echo '<pre>';
// print_r($query);
// echo '</pre>';
if( ! current_user_can( 'administrator' ) ) { return; }
if ( ! is_admin() && $query->is_main_query() ) {
// Not a query for an admin page.
// It's the main query for a front end page of your site.
@devendrabisht
devendrabisht / woocommerce-make-order-notes-required-in-checkout.php
Last active March 3, 2022 05:10
WooCommerce make order notes required in checkout
/**
* Make order notes required
*/
add_filter( 'woocommerce_checkout_fields' , 'dev_woocommerce_make_order_comments_required' );
function dev_woocommerce_make_order_comments_required( $fields ) {
$fields['order']['order_comments']['required'] = true;
return $fields;
}
// add_action( 'woocommerce_after_checkout_validation', 'dev_woocommerce_add_notice_for_empty_order_comments' );
@devendrabisht
devendrabisht / learnwithbisht-ld3-enable-comments.php
Last active June 5, 2019 16:55
How to enable comments with "Focus Mode" enabled for LearnDash elements ( Course, Lesson, Topic, Quiz ) - LD3
/**
* Code to activate comments for LearnDash elements.
*/
add_filter( 'learndash_focus_mode_comments', 'learnwithbisht_learndash_focus_mode_comments', 10, 2 );
function learnwithbisht_learndash_focus_mode_comments( $closed, $post ) {
/**
* Code to activate comments for course.
*/
if( 'sfwd-courses' === $post->post_type ) {
$closed = 'open';
@devendrabisht
devendrabisht / learnwithbisht-get-ninja-popup-data.php
Last active May 30, 2019 03:49
Get data posted from Ninja Popup using hook and use data captured for other purpose.
/**
* Code to get data posted from ninja popup.
*/
add_action( 'ninja_popups_send_form', 'learnwithbisht_ninja_popups_send_form', 10, 1 );
function learnwithbisht_ninja_popups_send_form( $filterAndActionData ) {
$post_data = $filterAndActionData['data']['post'];
$popup_ID = $post_data['popup_ID'];
$email = $post_data['email'];
/** write code here to use data as per requirement **/
}