function widget($args, $instance)
 {
     global $theme_option;
     $title = apply_filters('widget_title', $instance['title']);
     // Opening of widget
     echo $args['before_widget'];
     // Open of title tag
     if (!empty($title)) {
         echo $args['before_title'] . $title . $args['after_title'];
     }
     // Widget Content
     $category_list = gdlr_lms_get_term_list('course_category');
     echo '<div class="gdlr-course-category-widget widget_categories">';
     echo '<ul>';
     wp_list_categories(array('taxonomy' => 'course_category', 'title_li' => ''));
     echo '</ul>';
     // foreach($category_list as $cat_slug => $cat_name){
     // 	if($cat_slug == '') continue;
     //
     // 	echo '<li><a href="' . get_term_link($cat_slug, 'course_category') .  '" >';
     // 	echo $cat_name;
     // 	echo '</a></li>';
     // }
     echo '</div>';
     // Closing of widget
     echo $args['after_widget'];
 }
        function form($instance)
        {
            $title = isset($instance['title']) ? $instance['title'] : '';
            $category = isset($instance['category']) ? $instance['category'] : '';
            $num_fetch = isset($instance['num_fetch']) ? $instance['num_fetch'] : 3;
            ?>

			<!-- Text Input -->
			<p>
				<label for="<?php 
            echo $this->get_field_id('title');
            ?>
"><?php 
            _e('Title :', 'gdlr-lms');
            ?>
</label> 
				<input class="widefat" id="<?php 
            echo $this->get_field_id('title');
            ?>
" name="<?php 
            echo $this->get_field_name('title');
            ?>
" type="text" value="<?php 
            echo $title;
            ?>
" />
			</p>		

			<!-- Post Category -->
			<p>
				<label for="<?php 
            echo $this->get_field_id('category');
            ?>
"><?php 
            _e('Category :', 'gdlr-lms');
            ?>
</label>		
				<select class="widefat" name="<?php 
            echo $this->get_field_name('category');
            ?>
" id="<?php 
            echo $this->get_field_id('category');
            ?>
">
				<option value="" <?php 
            if (empty($category)) {
                echo ' selected ';
            }
            ?>
><?php 
            _e('All', 'gdlr-lms');
            ?>
</option>
				<?php 
            $category_list = gdlr_lms_get_term_list('course_category');
            foreach ($category_list as $cat_slug => $cat_name) {
                ?>
					<option value="<?php 
                echo $cat_slug;
                ?>
" <?php 
                if ($category == $cat_slug) {
                    echo ' selected ';
                }
                ?>
><?php 
                echo $cat_name;
                ?>
</option>				
				<?php 
            }
            ?>
	
				</select> 
			</p>
				
			<!-- Show Num --> 
			<p>
				<label for="<?php 
            echo $this->get_field_id('num_fetch');
            ?>
"><?php 
            _e('Num Fetch :', 'gdlr-lms');
            ?>
</label>
				<input class="widefat" id="<?php 
            echo $this->get_field_id('num_fetch');
            ?>
" name="<?php 
            echo $this->get_field_name('num_fetch');
            ?>
" type="text" value="<?php 
            echo $num_fetch;
            ?>
" />
			</p>

		<?php 
        }
예제 #3
0
function gdlr_lms_print_course_search($settings, $page_builder = false)
{
    if ($page_builder) {
        $item_id = empty($settings['page-item-id']) ? '' : ' id="' . $settings['page-item-id'] . '" ';
        global $gdlr_spaces;
        $margin = !empty($settings['margin-bottom']) && $settings['margin-bottom'] != $gdlr_spaces['bottom-blog-item'] ? 'margin-bottom: ' . $settings['margin-bottom'] . ';' : '';
        $margin_style = !empty($margin) ? ' style="' . $margin . '" ' : '';
        echo gdlr_get_item_title($settings);
    } else {
        $item_id = '';
        $margin_style = "";
    }
    $search_val = get_search_query();
    if (empty($search_val)) {
        $search_val = __("Keywords", "gdlr-lms");
    }
    $categories = gdlr_lms_get_term_list('course_category');
    echo '<div class="course-search-wrapper" ' . $item_id . $margin_style . ' >';
    ?>
<form class="gdlr-lms-form" action="<?php 
    echo home_url();
    ?>
/" >
	<div class="course-search-column gdlr-lms-1">
		<span class="gdlr-lms-combobox">
			<select name="course_category" >
				<option value="" ><?php 
    _e('Category', 'gdlr-lms');
    ?>
</option>
				<?php 
    foreach ($categories as $slug => $category) {
        echo '<option value="' . $slug . '" >' . $category . '</option>';
    }
    ?>
			</select>
		</span>
	</div>
	<div class="course-search-column gdlr-lms-2">
		<span class="gdlr-lms-combobox">
			<select name="course_type" id="gender" >
				<option value="" ><?php 
    _e('Type', 'gdlr-lms');
    ?>
</option>
				<option value="online" ><?php 
    _e('Online Course', 'gdlr-lms');
    ?>
</option>
				<option value="onsite" ><?php 
    _e('Onsite Course', 'gdlr-lms');
    ?>
</option>
			</select>
		</span>	
	</div>
	<div class="course-search-column gdlr-lms-3">
		<input type="text" name="s" id="s" autocomplete="off" placeholder="<?php 
    echo $search_val;
    ?>
" />
	</div>
	<div class="course-search-column gdlr-lms-4">
		<input type="hidden" name="post_type" value="course" />
		<input class="gdlr-lms-button" type="submit" value="<?php 
    _e('Search!', 'gdlr-lms');
    ?>
" />
	</div>
	<div class="clear"></div>
</form>

<?php 
    echo '</div>';
    // course-search-wrapper
}