Commit d9ff697e by Muhammad Usman

shortcodes, course-page, thank-pages

parent 216a50d1
Pipeline #189 passed with stage
in 0 seconds
......@@ -2,8 +2,9 @@
add_action('add_meta_boxes', 'vq_add_custom_meta_boxes', 10, 2);
function vq_render_short_banner_shortcode_metabox() {
echo '[vq_short_banner bgClr="" btnBg="" txt="" txtClr="" btnClr="" btnLink="" btnTxt=""]';
function vq_render_course_shortcode_metabox() {
echo '[vq_course_banner id="'. get_the_ID() .'"]';
}
function vq_render_course_attachment_metabox() {
......@@ -12,8 +13,9 @@ function vq_render_course_attachment_metabox() {
$file = file_get_contents(__DIR__ . '/includes/attachmentAndPrice.html');
$attachment_id = get_post_meta(get_the_ID(), 'course_attachment_id', true);
$attachment_title = get_post_meta(get_the_ID(), 'course_attachment_title', true);
$attachment_title = get_post_meta(get_the_ID(), 'course_attachment_url', true);
$courseFee = get_post_meta(get_the_ID(), 'course_fee', true);
$listing_content = get_post_meta(get_the_ID(), 'listing_content', true);
if($attachment_id > 0) {
$file = str_replace('[[ATTACHMENT]]', $attachment_title, $file);
......@@ -27,6 +29,11 @@ function vq_render_course_attachment_metabox() {
} else {
$file = str_replace('[[PRICE]]', '', $file);
}
if($listing_content) {
$file = str_replace('[[LISTING_CONTENT]]', $listing_content, $file);
} else {
$file = str_replace('[[LISTING_CONTENT]]', '', $file);
}
echo $file;
}
......@@ -35,8 +42,8 @@ function vq_add_custom_meta_boxes() {
add_meta_box(
'vq_short_banner_shortcode_metabox',
'Short Banner Shortcode',
'vq_render_short_banner_shortcode_metabox',
'Course Shortcode',
'vq_render_course_shortcode_metabox',
'vq_course',
'side',
'high'
......@@ -44,7 +51,7 @@ function vq_add_custom_meta_boxes() {
add_meta_box(
'vq_course_attachment_metabox',
'Attachment',
'Media & Settings',
'vq_render_course_attachment_metabox',
'vq_course',
'advanced',
......
......@@ -6,9 +6,11 @@ add_action('save_post_vq_course', 'vq_handle_course_post');
function vq_handle_course_post() {
if(isset($_POST['course_attachment_id'])) {
$attachment_id = $_POST['course_attachment_id'];
$attachment_title = $_POST['course_attachment_title'];
$attachment_url = $_POST['course_attachment_url'];
$listingContent = $_POST['listing_content'];
update_post_meta(get_the_ID(), 'course_attachment_id', $attachment_id);
update_post_meta(get_the_ID(), 'course_attachment_title', $attachment_title);
update_post_meta(get_the_ID(), 'course_attachment_url', $attachment_url);
update_post_meta(get_the_ID(), 'listing_content', $listingContent);
}
......
<label>Course Fee: </label>
<h3>Course Setting</h3>
<hr>
<br>
<label><strong>Course Fee: </strong></label>
<br>
<input type="text" name="course_fee" value="[[PRICE]]"/>
<br>
<br>
<label><strong>Listing Content</strong></label>
<br>
<textarea name="listing_content" id="" cols="30" rows="4">
[[LISTING_CONTENT]]
</textarea>
<br><br>
<input type="hidden" name="course_attachment_id" id="course_attachment_id" value="">
<input type="hidden" name="course_attachment_title" id="course_attachment_title" value="">
<h4 id="attachment_title">None</h4>
<input id="upload_course_attachment" type="button" class="button center-block" value="Upload Attachment"/>
<input id="remove_attachment" type="button" class="button center-block" value="Remove Attachment"/>
<input type="hidden" name="course_attachment_url" id="course_attachment_url" value="">
<video src="" width="200" id="course-video-holder" controls>
</video><br>
<input id="upload_course_attachment" type="button" class="button center-block" value="Upload Video"/>
<input id="remove_attachment" type="button" class="button center-block" value="Remove Video"/>
<script>
var title = '[[ATTACHMENT]]';
var url = '[[ATTACHMENT]]';
var attachment_id = [[ATTACHMENT_ID]];
if(attachment_id > 0) {
jQuery("#course_attachment_id").val(attachment_id);
jQuery("#attachment_title").text(title);
jQuery("#course_attachment_title").val(title);
jQuery("#course_attachment_url").val(url);
jQuery("#course-video-holder").attr('src', url);
}
jQuery("#remove_attachment").on('click', function() {
jQuery("#attachment_title").text('None');
jQuery("#course_attachment_id").val(-1);
jQuery("#course_attachment_title").val(-1);
jQuery("#course_attachment_url").val('');
jQuery("#course-video-holder").attr('src', '');
});
jQuery(document).ready(function () {
......@@ -35,17 +47,17 @@
return;
}
mediaUploader = wp.media.frames.file_frame = wp.media({
title: 'Select Attachment',
title: 'Select Video',
button: {
text: 'Choose Attachment'
text: 'Choose Video'
},
multiple: false
});
mediaUploader.on('select', function () {
attachment = mediaUploader.state().get('selection').first().toJSON();
jQuery("#course_attachment_id").val(attachment.id);
jQuery("#attachment_title").text(attachment.filename);
jQuery("#course_attachment_title").val(attachment.filename);
jQuery("#course_attachment_url").val(attachment.url);
jQuery("#course-video-holder").attr('src', attachment.url);
});
mediaUploader.open();
});
......
......@@ -23,7 +23,7 @@
<div class="intro-heading">
<p>[[BANNER_DESCRIPTION]]</p>
</div>
<button type="submit" class="learn-button-1">Loern More</button>
<a href="[[REDIRECT_URL]]" class="learn-button-1">Learn More</a>
</div>
</div>
</div>
......
......@@ -31,6 +31,14 @@ function vq_lms_settings_init() {
);
add_settings_field(
'vq_lms_settings_field_shortcode',
'Banner Shortcode',
'vq_lms_settings_field_shortcode_cb',
'vq_lms_settings',
'vq_lms_settings_section_developers'
);
add_settings_field(
'vq_lms_settings_field_currency_name',
'Currency Name',
'vq_lms_settings_field_currency_name_cb',
......@@ -182,6 +190,10 @@ function vq_lms_settings_field_video_cb($args) {
<?php
}
function vq_lms_settings_field_shortcode_cb() {
echo '[vq_short_banner bgClr="" btnBg="" txt="" txtClr="" btnClr="" btnLink="" btnTxt=""]';
}
function vq_lms_settings_page() {
add_submenu_page('edit.php?post_type=vq_course',
......
......@@ -18,15 +18,11 @@ add_filter('wp_nav_menu_items', 'vq_add_lms_navigation', 10, 2);
add_filter( 'query_vars', 'vq_query_vars_filter' );
add_action( 'admin_menu', 'vq_add_plugin_setting_page' );
add_shortcode('vq_short_banner', 'vq_render_short_banner');
add_filter( 'query_vars', 'vq_query_vars_filter' );
add_shortcode('vq_short_banner', 'vq_render_short_banner');
add_shortcode('vq_large_banner', 'vq_render_large_banner');
add_shortcode('vq_course_banner', 'vq_render_course_banner');
function vq_apex_custom_posts() {
......@@ -56,7 +52,7 @@ function vq_apex_custom_posts() {
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'vq_course' ),
'rewrite' => array( 'slug' => 'lms-course' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
......@@ -101,6 +97,42 @@ function vq_apex_custom_posts() {
);
register_post_type( 'vq_lms_drequest', $args );
/* Pricing Requests Post Type */
$labels = array(
'name' => __( 'Pricing Requests'),
'singular_name' => __( 'Pricing Request'),
'menu_name' => __( 'Pricing Requests'),
'name_admin_bar' => __( 'Pricing Requests'),
'add_new' => __( 'Add New', 'download_request'),
'add_new_item' => __( 'Add New Pricing Request'),
'new_item' => __( 'New Pricing Request'),
'edit_item' => __( 'Edit Pricing Request'),
'view_item' => __( 'View Pricing Request'),
'all_items' => __( 'Pricing Requests'),
'search_items' => __( 'Search Pricing Requests'),
'parent_item_colon' => __( 'Parent Pricing Requests:'),
'not_found' => __( 'No Pricing Request found.'),
'not_found_in_trash' => __( 'No Pricing Request found in Trash.')
);
$args = array(
'labels' => $labels,
'description' => __( 'Description.'),
'public' => false,
'publicly_queryable' => false,
'show_ui' => true,
'show_in_menu' => "edit.php?post_type=vq_course",
'query_var' => true,
'rewrite' => false,
'capability_type' => 'post',
'has_archive' => false,
'hierarchical' => false,
'supports' => array( 'title', 'editor', 'thumbnail')
);
register_post_type( 'vq_lms_prequest', $args );
}
function vq_apex_custom_taxonomies() {
......@@ -155,16 +187,21 @@ function vq_render_short_banner($attr) {
$banner = str_replace('[[TXT_CLR]]', $txtClr, $banner);
$banner = str_replace('[[BTN_CLR]]', $btnClr, $banner);
echo $banner;
return $banner;
}
function vq_render_large_banner($attr) {
function vq_render_course_banner($attr) {
$pgslg = isset($attr['pgslg']) ? $attr['pgslg'] : "none";
if(!isset($attr['id'])) {
return 'No Course Found';
} else {
$cid = $attr['id'];
}
$page = get_page_by_path($pgslg);
$page = get_post($cid);
$banner = file_get_contents(__DIR__ . '/admin/includes/large-banner.html');
......@@ -172,8 +209,10 @@ function vq_render_large_banner($attr) {
$banner = str_replace('[[BANNER_DESCRIPTION]]', $page->post_content, $banner);
$banner = str_replace('[[BG_IMG]]', get_the_post_thumbnail_url(get_page_by_path($pgslg)), $banner);
$banner = str_replace('[[BG_IMG]]', get_the_post_thumbnail_url($page->id), $banner);
$banner = str_replace('[[REDIRECT_URL]]', get_permalink($page->ID), $banner);
echo $banner;
return $banner;
}
......@@ -12,6 +12,7 @@ function enqueue_admin_css()
function use_lms_template($data)
{
global $post;
if(is_page('lms')){
return __DIR__ . "/template/e-learning.php";
}
......@@ -24,5 +25,14 @@ function use_lms_template($data)
return __DIR__ . '/template/download-now.php';
}
else if(is_page('thank-you-download') || is_page('thank-you-pricing')) {
return __DIR__ . '/template/thank-you-download.php';
}
else if ($post->post_type === 'vq_course') {
return __DIR__ . '/template/single-course.php';
}
else if(is_page('lms-pricing')) {
return __DIR__ . '/template/pricing-request.php';
}
return $data;
}
......@@ -82,11 +82,11 @@
{
background-color: #f89f18; color: white; border: 2px solid #f89f18;
}
.learn-button-1
.learn-button-1, a.learn-button-1
{
background-color: #41a4cb; padding-left: 30px; padding-right: 30px; padding-top: 10px; padding-bottom: 10px; color: #fff; font-size: 14px; font-weight: bold; text-transform: uppercase; text-align: center; letter-spacing: 2px; border: 0px; margin-top: 20px;
}
.learn-button-1:hover
.learn-button-1:hover, a.learn-button-1:hover
{
background-color: #fff; color: #41a4cb;
}
......
......@@ -6,10 +6,6 @@ $course_categories = get_terms( array(
'taxonomy' => 'vq_course_taxonomy',
'hide_empty' => false,
));
//echo "<pre>";
//print_r($course_categories);
//exit;
?>
<div class="bootstrap-iso">
......@@ -57,7 +53,7 @@ $course_categories = get_terms( array(
</div>
</div>
<?php do_shortcode('[vq_short_banner
<?php echo do_shortcode('[vq_short_banner
txtClr="#fff"
btnClr="#fff"
bgClr="#f89f18"
......@@ -65,7 +61,7 @@ $course_categories = get_terms( array(
btnTxt="Download Full List Of Courses"
txt="Not sure which course to take?"]'); ?>
<?php do_shortcode('[vq_large_banner pgslg="banner"]') ?>
<?php echo do_shortcode('[vq_course_banner id="6173"]') ?>
</div>
<?php
get_footer();
......
......@@ -8,10 +8,6 @@ $args = array(
);
$courses = new WP_Query($args);
//exit;
//die;
?>
<div class="bootstrap-iso">
<div class="e-learning-banner">
......@@ -99,7 +95,7 @@ $courses = new WP_Query($args);
</div>
</div>
<?php do_shortcode('[vq_short_banner
<?php echo do_shortcode('[vq_short_banner
txtClr="#fff"
btnClr="#fff"
bgClr="#f89f18"
......@@ -107,7 +103,7 @@ $courses = new WP_Query($args);
btnTxt="Download Full List Of Courses"
txt="Not sure which course to take?"]'); ?>
<?php do_shortcode('[vq_short_banner
<?php echo do_shortcode('[vq_short_banner
txtClr="#fff"
btnClr="#fff"
bgClr="#2898c4"
......
<?php
get_header();
$meta = get_post_meta(get_the_ID());
?>
<div class="bootstrap-iso">
<div class="e-learning-banner" style="background-image: url(<?php echo get_the_post_thumbnail_url(get_the_ID()); ?>)">
<div class="container">
<div class="row">
<div class="e-learning-heading">
<h2><?php echo get_the_title() ?></h2>
<h3><?php echo get_the_excerpt(); ?></h3>
</div>
</div>
</div>
</div>
<div class="learning-profile-bg">
<div class="container">
<div class="row">
<?php echo get_the_content(); ?>
</div>
</div>
</div>
<div class="container" style="margin-top: 15px; margin-bottom: 30px;">
<div class="row">
<div class="col-sm-8">
<video src="<?php echo $meta['course_attachment_url'][0]; ?>" width="100%" controls>
</video>
<div class="course-box">
<div class="col-sm-3 col-padding">
<?php the_post_thumbnail('thumbnail') ?>
</div>
<div class="col-sm-6">
<div class="course-heading">
<?php echo $meta['listing_content'][0]; ?>
</div>
</div>
<div class="col-sm-3 col-padding">
<div class="download-course-box">
<div class="course-heading">
<h4><a href="<?php echo get_permalink(get_page_by_path('download-all')) ?>">Download <br>course list</a></h4>
</div>
<div class="text-center">
</div>
</div>
</div>
<div class="clear"></div>
</div>
</div>
<div class="col-sm-4">
<div class="inquire-box">
<div class="inquire-heading">
<h2>Inquire Now</h2>
</div>
<div class="col-sm-12">
<input type="email" class="form-control text-feild" id="exampleInputEmail1"
placeholder="Name">
</div>
<div class="col-sm-12">
<input type="email" class="form-control text-feild" id="exampleInputEmail1"
placeholder="Email">
</div>
<div class="col-sm-12">
<select class="form-control text-feild">
<option>E-Learning Solution</option>
<option>2</option>
<option>3</option>
<option>4</option>
<option>5</option>
</select>
</div>
<div class="col-sm-12">
<textarea class="form-control text-feild" placeholder="Message" rows="5"></textarea>
</div>
<div class="col-sm-12">
<input type="email" class="form-control text-feild" id="exampleInputEmail1"
placeholder="Verification Code">
</div>
<div class="col-sm-12">
<button type="submit" class="submit-course-button">Submit</button>
</div>
<div class="clear"></div>
</div>
</div>
</div>
</div>
<?php do_shortcode('[vq_short_banner
txtClr="#fff"
btnClr="#fff"
bgClr="#2898c4"
btnBg="#f89f18"
btnTxt="Sign Up today"
txt="Ready to begin?"]'); ?>
</div>
<?php
get_footer();
?>
\ No newline at end of file
......@@ -16,7 +16,7 @@
<div class="row">
<div class="col-sm-12">
<div class="thankyou-heading">
<h2>Your download should start automatically. if not, please click this link</h2>
<h2>Kindly check the provided email, You shall soon get a download link for the courses.</h2>
</div>
</div>
</div>
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment