Skip to content

Instantly share code, notes, and snippets.

View ibrahim-kardi's full-sized avatar

Mohammad Ibrahim ibrahim-kardi

  • Mirpur, Dhaka -1216,Bangladesh
View GitHub Profile
/**
* Enrolled Course Shortcode
*/
function tutor_enrolled_course_register_shortcodes() {
add_shortcode( 'enrolled-course', 'shortcode_tutor_enrolled_course' );
}
add_action( 'init', 'tutor_enrolled_course_register_shortcodes' );
/**
function add_buynow_after_addtocart() {
// get the current post/product ID
$product_id = tutor_utils()->get_course_product_id();
// get the "Checkout Page" URL
$checkout_url = wc_get_checkout_url();
// Buy now button
echo '<a href="'.$checkout_url.'?add-to-cart='.$product_id.'">Buy Now</a>';
}
add_action( 'tutor_after_add_to_cart_button', 'add_buynow_after_addtocart' );
//***Need to override tutor-course.php file from plugins-> tutor->templates-> shortcode
<?php
/**
* @package TutorLMS/Templates
* @version 1.4.3
*/
$column_per_row = $GLOBALS['tutor_shortcode_arg']['column_per_row'];
//need to replace 262-263 line with this code in the templates->course-course-list.php file
<div class="tutor-course-loop-price">
<?php
$course_id = get_the_ID();
$is_public = get_post_meta( $course_id, '_tutor_is_public_course', true )=='yes';
$enroll_btn = '<div class="tutor-public-course-start-learning">' . apply_filters( 'tutor_course_restrict_new_entry', '<a href="'. get_the_permalink(). '">' . __('Get Enrolled', 'tutor') . '</a>' ) . '</div>';
$default_price = apply_filters('tutor-loop-default-price', ($is_public ? '' : __('Free', 'tutor') ));
$free_html = '<div class="price"> '.$default_price.$enroll_btn. '</div>';
@ibrahim-kardi
ibrahim-kardi / Ajax.php
Created October 29, 2021 10:02
certificate-language-issue- File path to replace. ~/wp-content/plugins/tutor-lms-certificate-builder/src/Ajax.php
<?php
/**
* Class Ajax
*
* @package Tutor\Certificate\Builder
* @author Themeum <[email protected]>
* @license GPLv2 or later
* @link https://www.themeum.com/product/tutor-lms/
* @since 1.0.0
add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
show_admin_bar(false);
}
}
add_action( 'init', 'blockusers_init' ); function blockusers_init() { if ( is_admin() && ! current_user_can( 'administrator' ) && ! ( defined( 'DOING_AJAX' ) && DOING_AJAX ) ) { wp_redirect( home_url() ); exit; } }
@ibrahim-kardi
ibrahim-kardi / filters.php
Last active November 4, 2021 04:48
Need to modify the filters.php file ,here : plugins\tutor\templates\course-filter\filters.php ,added a line in 12 and modified code 58-64
<?php
$filter_object = new \TUTOR\Course_Filter();
// $filter_levels = array(
// 'beginner' => __('Beginner', 'tutor'),
// 'intermediate' => __('Intermediate', 'tutor'),
// 'expert' => __('Expert', 'tutor')
// );
$filter_prices = array(
'free' => __('Free', 'tutor'),
'paid' => __('Paid', 'tutor'),
function my_custom_css() {
echo '<style>
.post-type-product #ovaem_sectionid {
display: none !important;
}
</style>';
}
add_action('admin_head', 'my_custom_css' );
@ibrahim-kardi
ibrahim-kardi / custom meta field in woocommerce product page
Created October 31, 2021 15:27
custom meta field in woocommerce product page
## ---- 1. Backend ---- ##
// Adding a custom Meta container to admin products pages
add_action('add_meta_boxes', 'create_custom_meta_box');
if (!function_exists('create_custom_meta_box')) {
function create_custom_meta_box()
{
add_meta_box(
'custom_product_meta_box',
__(' Product Main URL <em>(orginal)</em>', 'cmb'),
function custom_scripts_method() {
/* CSS */
wp_enqueue_style( 'custom-style', home_url('/wp-content/plugins/qubely/assets/css/qubely.bundle.min.css'));
}
add_action( 'wp_enqueue_scripts', 'custom_scripts_method' );