Skip to content

Instantly share code, notes, and snippets.

View wbcomdev's full-sized avatar

Wbcom Dev wbcomdev

View GitHub Profile
<?php
add_action('plugins_loaded','wp_remove_sold_individually');
function wp_remove_sold_individually(){
remove_filter( 'woocommerce_quantity_input_max', 'woo_sell_service_quantity_input_max', 10 ,2 );
}
?>
<?php
add_filter('bp_activity_reshare_post_type', 'function_name' );
function function_name( $post_type ) {
$post_type[] = 'custom post type slug';
return $post_type;
}
?>
<?php
/**
* Use below snippet to display content before topics.
*/
function ld_dashboard_call() {
echo '<h2>Before Topic Form</h2>';
}
add_action( 'ld_dashboard_before_topic_filter', 'ld_dashboard_call' );
<?php
/**
* Use below snippet to display content before topics.
*/
function ld_dashboard_call() {
echo '<h2>Before Topic Content</h2>';
}
add_action( 'ld_dashboard_before_topics_content', 'ld_dashboard_call' );
<?php
/**
* Use below snippet to display content before topics.
*/
function ld_dashboard_call() {
echo '<h2>Before Topic Content</h2>';
}
add_action( 'ld_dashboard_before_topics_content', 'ld_dashboard_call' );
<?php
/**
* Use below snippet to display content after student status.
*/
function ld_dashboard_student_status_after_call( $curr_user_id ) {
$user_meta = get_userdata( $curr_user_id );
echo '<h2>Current User Role :' . $user_meta->roles[0] . '</h2>';
}
add_action( 'ld_dashboard_student_status_after', 'ld_dashboard_student_status_after_call' );
<?php
/**
* Use below snippet to display content before student status.
*/
function ld_dashboard_student_status_before_call( $curr_user_id ) {
$user_meta = get_userdata( $curr_user_id );
echo '<h2>Current User Role :' . $user_meta->roles[0] . '</h2>';
}
add_action( 'ld_dashboard_student_status_before', 'ld_dashboard_student_status_before_call' );
<?php
/**
* Use below snippet to display no course text.
*/
function ld_dashboard_no_course_created_text_call( $fields ) {
return 'Course Not Found !!!!';
}
add_filter( 'ld_dashboard_no_course_created_text', 'ld_dashboard_no_course_created_text_call', 10, 1 );
<?php
/*
** Add a custom field on question front end form
*/
function ld_dashboard_questions_form_fields_callback( $fields ) {
/**
* Add following classes to add fields in specific sections.
*
* For 'Main' tab - 'ld-dashboard-form-post-data-tab'
<?php
/*
** Add a custom field on quiz front end form
*/
function ld_dashboard_quiz_form_fields_callback( $fields ) {
/**
* Add following classes to add fields in specific sections.
*
* For 'Main' tab - 'ld-dashboard-form-post-data-tab'