Skip to content

Instantly share code, notes, and snippets.

View wpbean's full-sized avatar

Imran Khan wpbean

View GitHub Profile
@wpbean
wpbean / functions.php
Created February 29, 2020 08:12
LearnPress add custom tabs to courses
<?php
/**
* Add Custom Tab
* Add this code to your theme or child theme functions.php file
*/
add_filter( 'learn-press/course-tabs', 'wp_education_course_tab_customize' );
function wp_education_course_tab_customize( $tabs ){
@wpbean
wpbean / functions.php
Last active February 22, 2020 06:59
WPB WooCommerce Related Products Slider - Related Products by Sub categories only
<?php
/**
* Related Products by Sub categories only
*/
add_filter('wpb_wrps_related_products_args', 'wpb_wrps_filter_woocommerce_related_products_args');
function wpb_wrps_filter_woocommerce_related_products_args($args)
{
@wpbean
wpbean / functions.php
Created November 5, 2019 14:08
Add custom post type support for WPB accordion menu and category post
<?php
add_filter( 'wpb_wmca_category_css_class', 'wpb_wmca_add_support_single_doc', 10, 4 );
function wpb_wmca_add_support_single_doc($css_classes, $category, $depth, $args){
if( is_singular( 'docs' ) ){
if ( ! empty( $args['current_category'] ) ) {
if ( $args['current_category'] === $category->term_id ) {
$css_classes[] = 'current-cat';
}
@wpbean
wpbean / functions.php
Created October 26, 2019 20:02
Add Custom Related Products Globally to all the Related Products
<?php
// Add the following code on your theme or child theme functions.php file -
if( !function_exists('wpb_wrps_add_custom_related_products') ){
function wpb_wrps_add_custom_related_products( $args ) {
global $product;
@wpbean
wpbean / functions.php
Last active May 12, 2020 12:19
Reptro theme add custom dynamic tabs to the LearnPress
<?php
/**
* Add Custom Tab
*/
add_filter( 'reptro_course_options', 'reptro_course_options_custom_fields' );
function reptro_course_options_custom_fields( $fields ){
$fields[] = array(
@wpbean
wpbean / functions.php
Created July 20, 2019 18:49
WPB WooCommerce LightBox Pro adding support of WooCommerce quotation plugin
<?php
add_action( 'wpb_wl_woocommerce_product_summary', 'wpb_wl_wc_quotation', 30 );
function wpb_wl_wc_quotation(){
global $product;
?>
<div class="<?php echo $product->get_type() . "_add_to_quote button_add_to_quote" ?>">
<button class="single_adq_button button alt" id="add_to_quote"
<?php echo $product->get_type() === 'variable' ? 'data-enable-button="' . get_option( 'adq_enable_button_outofstock', 'no' ) . '"' : '' ?>
@wpbean
wpbean / functions.php
Created June 24, 2019 18:46
WPB Filterable Portfolio Post Type Labels Update
<?php
add_filter( 'wpb_fp_portfolio_post_type_labels', 'wpb_fp_portfolio_post_type_labels_update' );
function wpb_fp_portfolio_post_type_labels_update( $labels ){
$labels = array(
'name' => esc_html_x( 'WPB Portfolios', 'Post Type General Name', WPB_FP_TEXTDOMAIN ),
'singular_name' => esc_html_x( 'Portfolio', 'Post Type Singular Name', WPB_FP_TEXTDOMAIN ),
'menu_name' => esc_html__( 'WPB Portfolio', WPB_FP_TEXTDOMAIN ),
'parent_item_colon' => esc_html__( 'Parent Portfolio:', WPB_FP_TEXTDOMAIN ),
@wpbean
wpbean / functions.php
Created June 17, 2019 15:55
LearnPress course image link to course details page
<?php
add_filter( 'learn_press_single_course_image_html', 'learn_press_single_course_image_html_update', 10, 2 );
function learn_press_single_course_image_html_update( $image, $id ){
$image_title = get_the_title( get_post_thumbnail_id($id) ) ? esc_attr( get_the_title( get_post_thumbnail_id() ) ) : '';
$image_caption = get_post( get_post_thumbnail_id($id) ) ? esc_attr( get_post( get_post_thumbnail_id() )->post_excerpt ) : '""';
$image_link = get_the_permalink( $id );
$image = get_the_post_thumbnail( $id, apply_filters( 'single_course_image_size', 'single_course' ), array(
'title' => $image_title,
@wpbean
wpbean / functions.php
Created May 30, 2019 23:02
WPB WooCommerce Product Slider (Free version) image size change
<?php
/**
* Add this code on your theme functions.php file
*/
add_filter( 'wpb_wps_product_archive_thumbnail_size', 'wpb_wps_product_archive_thumbnail_size_update' );
function wpb_wps_product_archive_thumbnail_size_update( $size ){
$size = 'large'; // your image size
@wpbean
wpbean / functions.php
Created May 27, 2019 18:41
LearnPress change back to class text
<?php
/*
* https://themeforest.net/item/reptro-online-course-wordpress-theme/21817850
*/
remove_action( 'learn-press/after-checkout-form', 'learn_press_back_to_class_button' );
remove_action( 'learn-press/after-empty-cart-message', 'learn_press_back_to_class_button' );
add_action( 'learn-press/after-checkout-form', 'reptro_learn_press_back_to_class_button' );
add_action( 'learn-press/after-empty-cart-message', 'reptro_learn_press_back_to_class_button' );