Skip to content

Instantly share code, notes, and snippets.

@99manish
Last active March 26, 2019 10:41
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/c619b2c47c27991a95eba90f762f67b9 to your computer and use it in GitHub Desktop.
Save 99manish/c619b2c47c27991a95eba90f762f67b9 to your computer and use it in GitHub Desktop.
Add course tags
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">
<ul class="tags">
<?php $tags = get_terms('course-tag');
foreach($tags as $tag) {
echo '<li><a href="'.get_term_link($tag->slug, 'course-tag').'">'.$tag->name.'</a></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