Skip to content

Instantly share code, notes, and snippets.

View ibrahim-kardi's full-sized avatar

Mohammad Ibrahim ibrahim-kardi

  • Johor bahru, Malaysia
View GitHub Profile
@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
//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>';
//***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'];
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' );
/**
* 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' );
/**
add_shortcode( 'sales', 'show_sales_by_product_id' );
function show_sales_by_product_id( $atts ) {
$atts = shortcode_atts( array(
'id' => ''
), $atts );
$units_sold = get_post_meta( $atts['id'], 'total_sales', true );
{
"categories": [
{
"name": "Electronics",
"slug": "",
"description": "",
"meta": "",
"order": 0,
"child":[
@ibrahim-kardi
ibrahim-kardi / git command
Created November 12, 2019 17:34
necessary git comand
# to initialize
git init
#Add the files in your new local repository. This stages them for the first commit
git add .
#Commit the files that you’ve staged in your local repository
git commit -m "initial commit"
#add the URL for the remote repository where your local repository will be pushed
@ibrahim-kardi
ibrahim-kardi / copy_file.sh
Created November 5, 2019 16:25
copy a file bash code for ubuntu
#!/bin/bash
i=2
while (( i++ < 1000 )); do
cp ka1.txt "test$i.txt"
done
#file acess permission
chmod +x copy.sh