Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save madhvendras84/5a4c04a33ea5e5a6f293809eacda1dce to your computer and use it in GitHub Desktop.
Save madhvendras84/5a4c04a33ea5e5a6f293809eacda1dce to your computer and use it in GitHub Desktop.
add_filter('wplms_course_creation_tabs','shakti_add_in_front_end',487);
function shakti_add_in_front_end($settings){
$fields = $settings['course_settings']['fields'];
$arr=array(array(
'label' => __('Hide take this course button','wplms-front-end'),
'desc' => __('Hide take this course button on single course page','wplms-front-end'),
'text'=>__('To hide the take this course button on single course page','wplms-front-end' ),
'id' => 'hide_take_this_course_button',
'type' => 'yesno',
'options' => array(
array('value' => 'S',
'label' =>__('Show','vibe-customtypes')),
array('value' => 'H',
'label' =>__('Hide','vibe-customtypes')),
),
'std' => 'S'
),
array(
'label' => __('Enter Shortcode','wplms-front-end'), // <label>
'desc' => __('This shortcode will appear only if take this course button is','wplms-front-end'),
'text'=>__("This shortcode will appear only if the take this course button is hidden (NOTE: use single quotes within shortcode for example [icon icon='icon-cancel-squared' size='18px']",'wplms-front-end' ),
'id' => 'show_shortcode',
'default'=> __('Enter your shortcode','wplms-front-end'),
'type' => 'text'
)
);
array_splice($fields, (count($fields)-1), 0,$arr );
$settings['course_settings']['fields'] = $fields;
return $settings;
}
add_action('wplms_the_course_button', 'shakti_hide_take_this_course_button', 488);
function shakti_hide_take_this_course_button(){
global $post;
$course_id = $post->ID;
$option = get_post_meta($course_id,'hide_take_this_course_button', true);
$showShortcode = get_post_meta($course_id,'show_shortcode', true);
$hide = false;
if($option == 'H' && isset($option)){
?>
<style>
.single-course .widget.pricing form input.course_button.full.button {display: none;}
</style>
<?php
$hide = true;
}
if($hide){
echo "<h5> Check Course Price Or Register </h5>";
echo do_shortcode($showShortcode);
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment