Commit 59c4064d by Muhammad Usman

sub category fix

parent 0ba0a1b0
Pipeline #336 passed with stage
in 0 seconds
...@@ -41,6 +41,8 @@ if ( ! class_exists( 'CT_TAX_META' ) ) { ...@@ -41,6 +41,8 @@ if ( ! class_exists( 'CT_TAX_META' ) ) {
<input type="button" class="button button-secondary ct_tax_media_button" id="ct_tax_media_button" name="ct_tax_media_button" value="Add Image" /> <input type="button" class="button button-secondary ct_tax_media_button" id="ct_tax_media_button" name="ct_tax_media_button" value="Add Image" />
<input type="button" class="button button-secondary ct_tax_media_remove" id="ct_tax_media_remove" name="ct_tax_media_remove" value="Remove Image" /> <input type="button" class="button button-secondary ct_tax_media_remove" id="ct_tax_media_remove" name="ct_tax_media_remove" value="Remove Image" />
</p> </p>
<label for="">Redirect Link: </label>
<input type="text" class="form-control" name="vq_course_ct_tax_redirect" />
</div> </div>
<?php <?php
} }
...@@ -52,7 +54,9 @@ if ( ! class_exists( 'CT_TAX_META' ) ) { ...@@ -52,7 +54,9 @@ if ( ! class_exists( 'CT_TAX_META' ) ) {
public function save_category_image ( $term_id, $tt_id ) { public function save_category_image ( $term_id, $tt_id ) {
if( isset( $_POST['vq_course_taxonomy-image-id'] ) && '' !== $_POST['vq_course_taxonomy-image-id'] ){ if( isset( $_POST['vq_course_taxonomy-image-id'] ) && '' !== $_POST['vq_course_taxonomy-image-id'] ){
$image = $_POST['vq_course_taxonomy-image-id']; $image = $_POST['vq_course_taxonomy-image-id'];
$link = $_POST['vq_course_ct_tax_redirect'];
add_term_meta( $term_id, 'vq_course_taxonomy-image-id', $image, true ); add_term_meta( $term_id, 'vq_course_taxonomy-image-id', $image, true );
add_term_meta( $term_id, 'vq_course_ct_tax_redirect', $link, true );
} }
} }
...@@ -77,6 +81,9 @@ if ( ! class_exists( 'CT_TAX_META' ) ) { ...@@ -77,6 +81,9 @@ if ( ! class_exists( 'CT_TAX_META' ) ) {
<input type="button" class="button button-secondary ct_tax_media_button" id="ct_tax_media_button" name="ct_tax_media_button" value="Add Image" /> <input type="button" class="button button-secondary ct_tax_media_button" id="ct_tax_media_button" name="ct_tax_media_button" value="Add Image" />
<input type="button" class="button button-secondary ct_tax_media_remove" id="ct_tax_media_remove" name="ct_tax_media_remove" value="Remove Image" /> <input type="button" class="button button-secondary ct_tax_media_remove" id="ct_tax_media_remove" name="ct_tax_media_remove" value="Remove Image" />
</p> </p>
<?php $link = get_term_meta ( $term -> term_id, 'vq_course_ct_tax_redirect', true ); ?>
<label for="">Redirect Link: </label>
<input type="text" class="form-control" name="vq_course_ct_tax_redirect" value="<?php echo $link; ?>"/>
</td> </td>
</tr> </tr>
<?php <?php
...@@ -93,6 +100,9 @@ if ( ! class_exists( 'CT_TAX_META' ) ) { ...@@ -93,6 +100,9 @@ if ( ! class_exists( 'CT_TAX_META' ) ) {
} else { } else {
update_term_meta ( $term_id, 'vq_course_taxonomy-image-id', '' ); update_term_meta ( $term_id, 'vq_course_taxonomy-image-id', '' );
} }
$link = $_POST['vq_course_ct_tax_redirect'];
update_term_meta ( $term_id, 'vq_course_ct_tax_redirect', $link );
} }
/* /*
......
...@@ -4,6 +4,7 @@ get_header(); ...@@ -4,6 +4,7 @@ get_header();
$page = get_page_by_path('lms'); $page = get_page_by_path('lms');
$course_categories = get_terms( array( $course_categories = get_terms( array(
'taxonomy' => 'vq_course_taxonomy', 'taxonomy' => 'vq_course_taxonomy',
'parent' => 0,
'hide_empty' => false, 'hide_empty' => false,
)); ));
......
...@@ -20,6 +20,8 @@ $args = array( ...@@ -20,6 +20,8 @@ $args = array(
); );
$courses = new WP_Query($args); $courses = new WP_Query($args);
$courses1 = $courses; $courses1 = $courses;
$children = get_term_children( $term->term_id, 'vq_course_taxonomy' );
$crsList = array(); $crsList = array();
...@@ -55,22 +57,22 @@ $page = get_page_by_path('lms-courses'); ...@@ -55,22 +57,22 @@ $page = get_page_by_path('lms-courses');
<div class="container"> <div class="container">
<div class="row"> <div class="row">
<div class="col-sm-8"> <div class="col-sm-8">
<?php if($courses->have_posts()){ ?> <?php if(count($children) > 0){ ?>
<?php while($courses->have_posts()) { $courses->the_post(); ?> <?php foreach($children as $child){ ?>
<div class="course-box"> <div class="course-box">
<div class="col-sm-3 col-padding" style="line-height: 0;"> <div class="col-sm-3 col-padding" style="line-height: 0;">
<?php the_post_thumbnail('thumbnail') ?> <img src="<?php echo wp_get_attachment_url(get_term_meta($child, 'vq_course_taxonomy-image-id', true)) ?>" alt="">
</div> </div>
<div class="col-sm-6 col-padding"> <div class="col-sm-6 col-padding">
<div class="course-heading" > <div class="course-heading" style="padding-left: 8px;">
<h3><?php the_title(); ?> </h3> <h3><?php echo get_term_name($child, 'vq_course_taxonomy') ?> </h3>
<?php the_content(); ?> <p><?php echo get_term_field('description', $child) ?></p>
</div> </div>
</div> </div>
<div class="col-sm-3 col-padding"> <div class="col-sm-3 col-padding">
<div class="download-course-box"> <div class="download-course-box">
<div class="course-heading"> <div class="course-heading" >
<h4><a href="<?php echo '/download-all/?course=' .get_the_ID(); ?>">Download <br>course list</a></h4> <h4><a href="/<?php echo get_term_meta($child, 'vq_course_ct_tax_redirect', true) ?>">Download <br>course list</a></h4>
</div> </div>
</div> </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