Skip to content

Instantly share code, notes, and snippets.

@99manish
Created March 26, 2019 12:57
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 99manish/83bd70fcc10876bf802a6ffdd79ac0c9 to your computer and use it in GitHub Desktop.
Save 99manish/83bd70fcc10876bf802a6ffdd79ac0c9 to your computer and use it in GitHub Desktop.
only show related tags in course page
Go to wp-admin -> plugins -> editor-> wplms-customizer plugin->
and add following code below in wplms-customizer.php and add below css in custom.css :
Code:
add_action('init',function(){
register_taxonomy( 'course-tag', array( 'course'),
array(
'labels' => array(
'name' => 'Tag',
'menu_name' => 'Tag',
'singular_name' => 'Tag',
'add_new_item' => 'Add New Tag',
'all_items' => 'All Tags'
),
'public' => true,
'hierarchical' => false,
'show_in_menu' => 'lms',
'show_ui' => true,
'show_admin_column' => true,
'show_in_nav_menus' => true,
'rewrite' => array( 'slug' => 'course-tag', 'hierarchical' => true, 'with_front' => true ),
)
);
});
add_action('wplms_after_course_description',function(){
?>
<div class="tags">
<?php echo get_the_term_list(get_the_ID(),'course-tag','<ul class="tags"><li>','</li><li>','</li></ul>'); ?>
</div>
<?php
},99);
------
Add following css in wp-admin -> Appearance -> customizer -> custom.css :
Css:
.single-course .tags {margin-top:0;padding: 15px 0;}
.single-course div.tags {border:none;}
.single-course ul.tags {border-bottom:1px solid rgba(0,0,0,.08);}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment