b83ad077 by Jeff Balicki

resources

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 2566d956
1 .wp-admin .media-toolbar-secondary select {
2 margin: 11px 16px 0 0;
3 }
4
5 .media-term-section {
6 margin: 0 0 20px;
7 }
8
9 .media-terms {
10 background: #fff;
11 border: 1px solid #dfdfdf;
12 border-radius: 3px;
13 max-height: 145px;
14 overflow: auto;
15 padding: 6px 8px;
16 }
17
18 .wp-admin .media-terms label {
19 display: block;
20 }
21
22 .wp-admin .media-terms input[type="checkbox"] {
23 margin: 0 5px 0 0;
24 position: relative;
25 top: -1px;
26 width: auto;
27 }
28
29 .media-terms ul ul {
30 padding: 10px 0 5px 10px;
31 }
32
33 .media-terms ul li:last-child {
34 margin: 0;
35 }
36
37
38 .add-new-term {
39 display: none;
40 }
41
42 .media-save-terms {
43 position: relative;
44 }
45
46 .media-save-terms:before {
47 background: url( '../images/saving.gif ') no-repeat #fff;
48 content: '';
49 display: block;
50 height: 16px;
51 position: absolute;
52 right: 5px;
53 top: 5px;
54 width: 16px
55 }
56
57 .media-save-terms label {
58 opacity: .5
59 }
60
61 /* Add new media term */
62 .toggle-add-media-term {
63 display: inline-block;
64 margin: 5px 0;
65 }
66
67 .toggle-add-media-term:before {
68 content: '+ ';
69 }
70
71 .add-new-term {
72 margin: 0 0 5px;
73 }
74
1 jQuery(document).ready(function(){
2
3 var media = wp.media;
4
5 /*
6 // for debug : trace every event triggered in the Region controller
7 var originalTrigger = wp.media.view.MediaFrame.prototype.trigger;
8 wp.media.view.MediaFrame.prototype.trigger = function(){
9 console.log('MediaFrame Event: ', arguments[0]);
10 originalTrigger.apply(this, Array.prototype.slice.call(arguments));
11 }; //
12
13 // for Network debug
14 var originalAjax = media.ajax;
15 media.ajax = function( action ) {
16 console.log( 'media.ajax: action = ' + JSON.stringify( action ) );
17 return originalAjax.apply(this, Array.prototype.slice.call(arguments));
18 };
19 */
20
21 /**
22 * Extended Filters dropdown with taxonomy term selection values
23 */
24 if ( media ) {
25 jQuery.each(mediaTaxonomies,function(key,label){
26
27 media.view.AttachmentFilters[key] = media.view.AttachmentFilters.extend({
28 className: key,
29
30 createFilters: function() {
31 var filters = {};
32
33 _.each( mediaTerms[key] || {}, function( term ) {
34
35 var query = {};
36
37 query[key] = {
38 taxonomy: key,
39 term_id: parseInt( term.id, 10 ),
40 term_slug: term.slug
41 };
42
43 filters[ term.slug ] = {
44 text: term.label,
45 props: query
46 };
47 });
48
49 this.filters = filters;
50 }
51
52
53 });
54
55 /**
56 * Replace the media-toolbar with our own
57 */
58 var myDrop = media.view.AttachmentsBrowser;
59
60 media.view.AttachmentsBrowser = media.view.AttachmentsBrowser.extend({
61 createToolbar: function() {
62
63 media.model.Query.defaultArgs.filterSource = 'filter-media-taxonomies';
64
65 myDrop.prototype.createToolbar.apply(this,arguments);
66
67 this.toolbar.set( key, new media.view.AttachmentFilters[key]({
68 controller: this.controller,
69 model: this.collection.props,
70 priority: -80
71 }).render()
72 );
73 }
74 });
75
76 });
77 }
78
79 /* Save taxonomy */
80 jQuery('html').delegate( '.media-terms input', 'change', function(){
81
82 var obj = jQuery(this),
83 container = obj.parents('.media-terms'),
84 row = container.parent(),
85 data = {
86 action: 'save-media-terms',
87 term_ids: [],
88 attachment_id: container.data('id'),
89 taxonomy: container.data('taxonomy')
90 };
91
92 container.find('input:checked').each(function(){
93 data.term_ids.push( jQuery(this).val() );
94 });
95
96 row.addClass('media-save-terms');
97 container.find('input').prop('disabled', 'disabled');
98
99 jQuery.post( ajaxurl, data, function( response ){
100 row.removeClass('media-save-terms');
101 container.find('input').removeProp('disabled');
102 });
103
104 });
105
106 // Add new taxonomy
107 jQuery('html').delegate('.toggle-add-media-term', 'click', function(e){
108 e.preventDefault();
109 jQuery(this).parent().find('.add-new-term').toggle();
110 });
111
112 // Save new taxnomy
113 jQuery('html').delegate('.save-media-term', 'click', function(e){
114
115 var obj = jQuery(this),
116 termField = obj.parent().find('input'),
117 termParent = obj.parent().find('select'),
118 data = {
119 action: 'add-media-term',
120 attachment_id: obj.data('id'),
121 taxonomy: obj.data('taxonomy'),
122 parent: termParent.val(),
123 term: termField.val()
124 };
125
126 // No val
127 if ( '' == data.term ) {
128 termField.focus();
129 return;
130 }
131
132 jQuery.post(ajaxurl, data, function(response){
133
134 obj.parents('.field').find('.media-terms ul:first').html( response.checkboxes );
135 obj.parents('.field').find('select').replaceWith( response.selectbox );
136
137 console.log( response );
138
139 termField.val('');
140
141 }, 'json' );
142
143 });
144
145 });
1 msgid ""
2 msgstr ""
3 "Project-Id-Version: Media Taxonomies v1.0\n"
4 "Report-Msgid-Bugs-To: \n"
5 "POT-Creation-Date: \n"
6 "PO-Revision-Date: 2013-09-15 16:27:14+0000\n"
7 "Last-Translator: horttcore <me@horttcore.de>\n"
8 "Language-Team: \n"
9 "MIME-Version: 1.0\n"
10 "Content-Type: text/plain; charset=UTF-8\n"
11 "Content-Transfer-Encoding: 8bit\n"
12 "Plural-Forms: nplurals=2; plural=n != 1;\n"
13 "X-Generator: CSL v1.x\n"
14 "X-Poedit-Language: German\n"
15 "X-Poedit-Country: GERMANY\n"
16 "X-Poedit-SourceCharset: utf-8\n"
17 "X-Poedit-KeywordsList: __;_e;__ngettext:1,2;_n:1,2;__ngettext_noop:1,2;_n_noop:1,2;_c,_nc:4c,1,2;_x:1,2c;_ex:1,2c;_nx:4c,1,2;_nx_noop:4c,1,2;\n"
18 "X-Poedit-Basepath: \n"
19 "X-Poedit-Bookmarks: \n"
20 "X-Poedit-SearchPath-0: .\n"
21 "X-Textdomain-Support: yes"
22
23 #: media-taxonomies.php:223
24 #@ default
25 msgctxt "taxonomy general name"
26 msgid "Categories"
27 msgstr ""
28
29 #: media-taxonomies.php:224
30 #@ default
31 msgctxt "taxonomy singular name"
32 msgid "Category"
33 msgstr ""
34
35 #: media-taxonomies.php:225
36 #@ default
37 msgid "Search Categories"
38 msgstr ""
39
40 #: media-taxonomies.php:226
41 #@ default
42 msgid "All Categories"
43 msgstr ""
44
45 #: media-taxonomies.php:227
46 #@ default
47 msgid "Parent Category"
48 msgstr ""
49
50 #: media-taxonomies.php:228
51 #@ default
52 msgid "Parent Category:"
53 msgstr ""
54
55 #: media-taxonomies.php:229
56 #@ default
57 msgid "Edit Category"
58 msgstr ""
59
60 #: media-taxonomies.php:230
61 #@ default
62 msgid "Update Category"
63 msgstr ""
64
65 #: media-taxonomies.php:231
66 #@ default
67 msgid "Add New Category"
68 msgstr ""
69
70 #: media-taxonomies.php:232
71 #@ default
72 msgid "New Category Name"
73 msgstr ""
74
75 #: media-taxonomies.php:233
76 #@ default
77 msgid "Categories"
78 msgstr ""
79
80 #: media-taxonomies.php:237
81 #@ media-taxonomies
82 msgctxt "Category Slug"
83 msgid "media-category"
84 msgstr "medien-kategorie"
85
86 #: media-taxonomies.php:245
87 #@ default
88 msgctxt "taxonomy general name"
89 msgid "Tags"
90 msgstr ""
91
92 #: media-taxonomies.php:246
93 #@ default
94 msgctxt "taxonomy singular name"
95 msgid "Tag"
96 msgstr ""
97
98 #: media-taxonomies.php:247
99 #@ default
100 msgid "Search Tags"
101 msgstr ""
102
103 #: media-taxonomies.php:248
104 #@ default
105 msgid "All Tags"
106 msgstr ""
107
108 #: media-taxonomies.php:249
109 #@ default
110 msgid "Parent Tag"
111 msgstr ""
112
113 #: media-taxonomies.php:250
114 #@ default
115 msgid "Parent Tag:"
116 msgstr ""
117
118 #: media-taxonomies.php:251
119 #@ default
120 msgid "Edit Tag"
121 msgstr ""
122
123 #: media-taxonomies.php:252
124 #@ default
125 msgid "Update Tag"
126 msgstr ""
127
128 #: media-taxonomies.php:253
129 #@ default
130 msgid "Add New Tag"
131 msgstr ""
132
133 #: media-taxonomies.php:254
134 #@ default
135 msgid "New Tag Name"
136 msgstr ""
137
138 #: media-taxonomies.php:255
139 #@ default
140 msgid "Tags"
141 msgstr ""
142
143 #: media-taxonomies.php:259
144 #@ media-taxonomies
145 msgctxt "Tag Slug"
146 msgid "media-tag"
147 msgstr "medien-schlagwort"
148
149 #: media-taxonomies.php:287
150 #, php-format
151 #@ media-taxonomies
152 msgctxt "%1$s = plural, %2$s = singular"
153 msgid "View all %s"
154 msgstr "Alle %s"
155
1 === Media Taxonomies ===
2 Contributors: Horttcore
3 Donate link: http://horttcore.de
4 Tags: media, taxonomies
5 Requires at least: 3.8
6 Tested up to: 4.0
7 Stable tag: 1.3.0
8 License: GPLv2 or later
9 License URI: http://www.gnu.org/licenses/gpl-2.0.html
10
11 WordPress taxonomies for media files.
12
13 == Description ==
14
15 WordPress taxonomies for media files.
16 Plugin ships with media-category and media-tag taxonomy
17
18 == Installation ==
19
20 * Put the plugin file in your plugin directory and activate it in your WP backend.
21 * Go to your media library and add some categories
22
23 == FAQ ==
24
25 = Why does my term count not match if I add another taxonomy? =
26
27 This might be a failure in your register_taxanomy function.
28 You have to set `update_count_callback` to `_update_generic_term_count` in the taxonomy registration
29 Visit for more information http://codex.wordpress.org/Function_Reference/register_taxonomy
30
31 = I added another taxonomy for attachments, but don't want to use the features of this plugin. =
32
33 Ok, use the `media-taxonomies` hook to remove your taxonomy from the list
34
35 = Known Bugs =
36
37 * Registering a core taxonomy via `register_taxonomy_for_object_type( 'post_tag', 'attachment' )` won't work
38
39 == Screenshots ==
40
41 1. This screen shot description corresponds to screenshot-1.(png|jpg|jpeg|gif). Note that the screenshot is taken from
42 the /assets directory or the directory that contains the stable readme.txt (tags or trunk). Screenshots in the /assets
43 directory take precedence. For example, `/assets/screenshot-1.png` would win over `/tags/4.3/screenshot-1.png`
44 (or jpg, jpeg, gif).
45 2. This is the second screen shot
46
47 == Changelog ==
48
49 = 1.3 =
50
51 * Add new terms functionality
52 * Small improvements
53
54 = 1.2.2 =
55
56 * Small improvements
57
58 = 1.2.1 =
59
60 * Enhancement: Modal select box label changed to use WordPress standard - props Dirk
61
62 = 1.2 =
63
64 * Bugfix: Media modal filter did not work, broke due last versions fix
65
66 = 1.1 =
67
68 * Bugfix: Media overview filter did not work
69
70 = 1.0 =
71
72 * Added integrated modal filter - props Wyck
73 * Added german language file
74
75 = 0.9.1 =
76
77 * Added modal filter
78
79 = 0.9 =
80
81 * Preview version
82
83 == ToDo ==
84
85 * implement wp.media like 'All' selection, this is currently achieved by a workaround
...@@ -15453,7 +15453,7 @@ label[for=quicksearch] { ...@@ -15453,7 +15453,7 @@ label[for=quicksearch] {
15453 background-color: #2C2C2C; 15453 background-color: #2C2C2C;
15454 } 15454 }
15455 15455
15456 .course-list .element-item { 15456 .course-list:not(.resources) .element-item {
15457 position: relative; 15457 position: relative;
15458 float: left; 15458 float: left;
15459 width: calc(33.33% - 30px); 15459 width: calc(33.33% - 30px);
...@@ -15462,6 +15462,15 @@ label[for=quicksearch] { ...@@ -15462,6 +15462,15 @@ label[for=quicksearch] {
15462 padding: 10px; 15462 padding: 10px;
15463 } 15463 }
15464 15464
15465 .course-list.resources .element-item {
15466 position: relative;
15467 float: left;
15468 width: 100%;
15469 height: 60px;
15470 margin: 15px;
15471 padding: 10px;
15472 }
15473
15465 .view-plan { 15474 .view-plan {
15466 width: 100%; 15475 width: 100%;
15467 text-align: center; 15476 text-align: center;
...@@ -15489,6 +15498,10 @@ label[for=quicksearch] { ...@@ -15489,6 +15498,10 @@ label[for=quicksearch] {
15489 display: none; 15498 display: none;
15490 } 15499 }
15491 15500
15501 .isotope-pager .pager {
15502 display: inline-block;
15503 }
15504
15492 .type-sfwd-courses { 15505 .type-sfwd-courses {
15493 margin-top: 30px; 15506 margin-top: 30px;
15494 } 15507 }
......
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
...@@ -11,6 +11,9 @@ include 'inc/menu-widgets.php'; ...@@ -11,6 +11,9 @@ include 'inc/menu-widgets.php';
11 include 'inc/blocks.php'; 11 include 'inc/blocks.php';
12 include 'inc/custom-post-type.php'; 12 include 'inc/custom-post-type.php';
13 include 'inc/shortcodes.php'; 13 include 'inc/shortcodes.php';
14 include 'inc/shortcodes-course.php';
15 include 'inc/shortcodes-resources.php';
16
14 17
15 18
16 /** 19 /**
......
1 <?php
2
3 add_shortcode('course-list', 'course_list');
4
5
6 function course_list(){
7
8 $custom_args = array(
9 'post_type' => 'sfwd-courses',
10 'posts_per_page' => -1,
11 'paged' => 1,
12 );
13 $custom_query = new \WP_Query($custom_args);
14
15 ob_start();
16 $uniqid = uniqid();
17 if ($custom_query->have_posts()):?>
18 <div class="course-list">
19 <label for="quicksearch">Search programs:</label><input type="text" id="quicksearch" placeholder="" />
20 <div class="filters">
21 <a href="#" id="filter-more">FILTERS <span aria-hidden="true" class="glyphicon glyphicon-chevron-up"></span></a>
22 <div class="filter-group">
23 <div class="category-filter-group">
24 <?php $terms = get_terms( array( 'taxonomy' => 'ld_course_category' ,'parent' => 0) );
25 foreach($terms as $term){ ?>
26 <div class="category-filter"> <input id="<?php echo $term->slug ; ?>" value=".<?php echo $term->slug ; ?>" type="checkbox" class="sr-only"><label for="<?php echo $term->slug ; ?>"><?php echo $term->name ; ?></label></div>
27 <?php }; ?>
28 </div>
29 <div class="btn-group sort-button-group align-self-end">
30 <button class="btn btn-light" data-sort-direction="asc" data-sort-value="coursename" type="button">Name <span aria-hidden="true" class="glyphicon glyphicon-chevron-up"></span></button>
31 <button class="btn btn-light" data-sort-direction="asc" data-sort-value="coursedate" type="button">Date <span aria-hidden="true" class="glyphicon glyphicon-chevron-up"></span></button>
32 </div>
33 </div>
34 </div>
35 <div class="grid course">
36 <?php while ($custom_query->have_posts()): $custom_query->the_post();
37 echo course_card(get_the_ID());
38 endwhile; ?>
39 </div>
40 </div>
41 <?php endif;
42 wp_reset_query();
43 $output = ob_get_clean();
44 return $output;
45 }
46
47
48
49 function course_card($id){
50
51 ob_start();
52 $post = get_post($id);
53 $text = str_replace(']]>', ']]&gt;', apply_filters( 'the_content', strip_shortcodes($post->post_content)));
54 $excerpt_length = apply_filters( 'excerpt_length', 20 );
55 $text = wp_trim_words( $text, $excerpt_length, ' ...' );
56 $categories = get_the_terms( $id, 'ld_course_category' );
57 $cat =""; foreach( $categories as $category ) { $cat .= " ".$category->slug; }; ?>
58
59 <div class="element-item <?php echo $cat; ?> " data-category="<?php echo $cat; ?>">
60 <article id="post-<?php echo $id; ?>" class="post post-<?php echo $id; ?> sfwd-courses type-sfwd-courses">
61 <div class="card">
62 <div class="thumbnail"><div class="ribbon"><?php echo get_post_meta( $id, '_learndash_course_grid_custom_ribbon_text', true);?></div>
63 <div class="image">
64 <?php echo get_the_post_thumbnail($id, 'full' ); ?>
65 </div>
66 </div>
67 <div class="content">
68 <h3 class="entry-title"><?php echo $post->post_title; ?></h3>
69 <div class="entry-content">
70 <p><?php echo $text; ?></p>
71 </div>
72 <a class="btn" role="button" href="<?php echo get_permalink($id); ?>" rel="bookmark">LEARN MORE</a>
73
74 </div>
75 </div>
76 </article>
77 </div>
78
79 <?php
80 $output = ob_get_clean();
81 return $output;
82 }
...\ No newline at end of file ...\ No newline at end of file
1 <?php
2
3 add_shortcode('resources-list', 'resources_list');
4
5
6 function resources_list(){
7
8 $custom_args = array(
9 'post_type' => 'attachment',
10 'posts_per_page' => -1,
11 'paged' => 1,
12 'post_status' => 'any',
13 );
14 $custom_query = new \WP_Query($custom_args);
15
16 ob_start();
17 $uniqid = uniqid();
18 if ($custom_query->have_posts()):
19 ?>
20 <div class="course-list resources">
21 <label for="quicksearch">Search programs:</label><input type="text" id="quicksearch" placeholder="" />
22 <div class="filters">
23 <a href="#" id="filter-more">FILTERS <span aria-hidden="true" class="glyphicon glyphicon-chevron-up"></span></a>
24 <div class="filter-group">
25 <div class="category-filter-group">
26 <?php $terms = get_terms( array( 'taxonomy' => 'media-category' ,'parent' => 17) );
27 foreach($terms as $term){ ?>
28 <div class="category-filter"> <input id="<?php echo $term->slug ; ?>" value=".<?php echo $term->slug ; ?>" type="checkbox" class="sr-only"><label for="<?php echo $term->slug ; ?>"><?php echo $term->name ; ?></label></div>
29 <?php }; ?>
30 <?php $terms = get_terms( array( 'taxonomy' => 'media-category' ,'parent' => 22) );
31 foreach($terms as $term){ ?>
32 <div class="category-filter"> <input id="<?php echo $term->slug ; ?>" value=".<?php echo $term->slug ; ?>" type="checkbox" class="sr-only"><label for="<?php echo $term->slug ; ?>"><?php echo $term->name ; ?></label></div>
33 <?php }; ?>
34 </div>
35 <div class="btn-group sort-button-group align-self-end">
36 <button class="btn btn-light" data-sort-direction="asc" data-sort-value="coursename" type="button">Name <span aria-hidden="true" class="glyphicon glyphicon-chevron-up"></span></button>
37 <button class="btn btn-light" data-sort-direction="asc" data-sort-value="coursedate" type="button">Date <span aria-hidden="true" class="glyphicon glyphicon-chevron-up"></span></button>
38 </div>
39 </div>
40 </div>
41 <div class="grid resources">
42 <?php while ($custom_query->have_posts()): $custom_query->the_post();
43
44 echo resources(get_the_ID());
45 endwhile; ?>
46 </div>
47 </div>
48 <?php endif;
49 wp_reset_query();
50 $output = ob_get_clean();
51 return $output;
52 }
53
54
55
56 function resources($id){
57
58 ob_start();
59 $post = get_post($id);
60 $categories = get_the_terms( $id, 'media-category' );
61 $cat ="";
62 if(is_array( $categories)){
63 foreach( $categories as $category ) { $cat .= " ".$category->slug; };
64 } ?>
65
66 <div class="table-like__item element-item <?php echo $cat; ?> " data-category="<?php echo $cat; ?>">
67 <a role="button" href="<?php echo get_permalink($id); ?>"><?php echo $post->post_title; ?></a><br>
68 <?php echo wp_get_attachment_caption($id) ?>
69 </div>
70 <?php
71 $output = ob_get_clean();
72 return $output;
73 }
...\ No newline at end of file ...\ No newline at end of file
...@@ -99,87 +99,3 @@ function share_this($atts){ ...@@ -99,87 +99,3 @@ function share_this($atts){
99 <?php 99 <?php
100 return ob_get_clean(); 100 return ob_get_clean();
101 } 101 }
102
103
104
105
106 add_shortcode('course-list', 'course_list');
107
108
109 function course_list(){
110
111 $custom_args = array(
112 'post_type' => 'sfwd-courses',
113 'posts_per_page' => -1,
114 'paged' => 1,
115 );
116 $custom_query = new \WP_Query($custom_args);
117
118 ob_start();
119 $uniqid = uniqid();
120 if ($custom_query->have_posts()):?>
121 <div class="course-list">
122 <label for="quicksearch">Search programs:</label><input type="text" id="quicksearch" placeholder="" />
123 <div class="filters">
124 <a href="#" id="filter-more">FILTERS <span aria-hidden="true" class="glyphicon glyphicon-chevron-up"></span></a>
125 <div class="filter-group">
126 <div class="category-filter-group">
127 <?php $terms = get_terms( array( 'taxonomy' => 'ld_course_category' ,'parent' => 0) );
128 foreach($terms as $term){ ?>
129 <div class="category-filter"> <input id="<?php echo $term->slug ; ?>" value=".<?php echo $term->slug ; ?>" type="checkbox" class="sr-only"><label for="<?php echo $term->slug ; ?>"><?php echo $term->name ; ?></label></div>
130 <?php }; ?>
131 </div>
132 <div class="btn-group sort-button-group align-self-end">
133 <button class="btn btn-light" data-sort-direction="asc" data-sort-value="coursename" type="button">Name <span aria-hidden="true" class="glyphicon glyphicon-chevron-up"></span></button>
134 <button class="btn btn-light" data-sort-direction="asc" data-sort-value="coursedate" type="button">Date <span aria-hidden="true" class="glyphicon glyphicon-chevron-up"></span></button>
135 </div>
136 </div>
137 </div>
138 <div class="grid">
139 <?php while ($custom_query->have_posts()): $custom_query->the_post();
140 echo course_card(get_the_ID());
141 endwhile; ?>
142 </div>
143 </div>
144 <?php endif;
145 wp_reset_query();
146 $output = ob_get_clean();
147 return $output;
148 }
149
150
151
152 function course_card($id){
153
154 ob_start();
155 $post = get_post($id);
156 $text = str_replace(']]>', ']]&gt;', apply_filters( 'the_content', strip_shortcodes($post->post_content)));
157 $excerpt_length = apply_filters( 'excerpt_length', 20 );
158 $text = wp_trim_words( $text, $excerpt_length, ' ...' );
159 $categories = get_the_terms( $id, 'ld_course_category' );
160 $cat =""; foreach( $categories as $category ) { $cat .= " ".$category->slug; }; ?>
161
162 <div class="element-item <?php echo $cat; ?> " data-category="<?php echo $cat; ?>">
163 <article id="post-<?php echo $id; ?>" class="post post-<?php echo $id; ?> sfwd-courses type-sfwd-courses">
164 <div class="card">
165 <div class="thumbnail"><div class="ribbon"><?php echo get_post_meta( $id, '_learndash_course_grid_custom_ribbon_text', true);?></div>
166 <div class="image">
167 <?php echo get_the_post_thumbnail($id, 'full' ); ?>
168 </div>
169 </div>
170 <div class="content">
171 <h3 class="entry-title"><?php echo $post->post_title; ?></h3>
172 <div class="entry-content">
173 <p><?php echo $text; ?></p>
174 </div>
175 <a class="btn" role="button" href="<?php echo get_permalink($id); ?>" rel="bookmark">LEARN MORE</a>
176
177 </div>
178 </div>
179 </article>
180 </div>
181
182 <?php
183 $output = ob_get_clean();
184 return $output;
185 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -17636,9 +17636,9 @@ ...@@ -17636,9 +17636,9 @@
17636 if ($('.grid').length) { 17636 if ($('.grid').length) {
17637 // quick search regex 17637 // quick search regex
17638 var qsRegex; 17638 var qsRegex;
17639 17639 if ($('.grid.course').length) {
17640 // init Isotope 17640 // init Isotope
17641 var $grid = $('.grid').isotope({ 17641 var $grid = $('.grid.course').isotope({
17642 itemSelector: '.element-item', 17642 itemSelector: '.element-item',
17643 layoutMode: 'fitRows', 17643 layoutMode: 'fitRows',
17644 getSortData: { 17644 getSortData: {
...@@ -17652,12 +17652,98 @@ ...@@ -17652,12 +17652,98 @@
17652 return filterText && buttonResult; 17652 return filterText && buttonResult;
17653 } 17653 }
17654 }); 17654 });
17655 }
17656 if ($('.grid.resources').length) {
17657 var $grid = $('.grid.resources').isotope({
17658 itemSelector: '.element-item',
17659 layoutMode: 'vertical',
17660 getSortData: {
17661 coursename: '.name',
17662 date: '[data-ticks]'
17663 },
17664 filter: function () {
17665 var $this = $(this);
17666 var filterText = qsRegex ? $(this).text().match(qsRegex) : true;
17667 var buttonResult = filterValue ? $this.is(filterValue) : true;
17668 return filterText && buttonResult;
17669 }
17670 });
17671 var itemsPerPageDefault = 5;
17672 var itemsPerPage = defineItemsPerPage();
17673 var itemSelector = '.element-item';
17674 var currentNumberPages = 1;
17675 var currentPage = 1;
17676 var currentFilter = '*';
17677 var filterAtribute = 'data-filter';
17678 var pageAtribute = 'data-page';
17679 var pagerClass = 'isotope-pager';
17680 setPagination();
17681 goToPage(1);
17682 }
17683 function changeFilter(selector) {
17684 $grid.isotope({
17685 filter: selector
17686 });
17687 }
17688 function getFilterSelector() {
17689 var selector = itemSelector;
17690 if (currentFilter != '*') {
17691 selector += `[${filterAtribute}~="${currentFilter}"]`;
17692 }
17693 return selector;
17694 }
17695 function goToPage(n) {
17696 currentPage = n;
17697 var selector = getFilterSelector();
17698 selector += `[${pageAtribute}="${currentPage}"]`;
17699 changeFilter(selector);
17700 }
17701 function defineItemsPerPage() {
17702 var pages = itemsPerPageDefault;
17703 return pages;
17704 }
17705 function setPagination() {
17706 (function () {
17707 $grid.children(itemSelector).length;
17708 var item = 1;
17709 var page = 1;
17710 var selector = getFilterSelector();
17711 $grid.children(selector).each(function () {
17712 if (item > itemsPerPage) {
17713 page++;
17714 item = 1;
17715 }
17716 $(this).attr(pageAtribute, page);
17717 item++;
17718 });
17719 currentNumberPages = page;
17720 })();
17721 (function () {
17722 var $isotopePager = $('.' + pagerClass).length == 0 ? $('<div class="' + pagerClass + '"></div>') : $('.' + pagerClass);
17723 $isotopePager.html('');
17724 for (var i = 0; i < currentNumberPages; i++) {
17725 var $pager = $('<a href="javascript:void(0);" class="pager" ' + pageAtribute + '="' + (i + 1) + '"></a>');
17726 $pager.html(i + 1);
17727 $pager.click(function () {
17728 var page = $(this).eq(0).attr(pageAtribute);
17729 goToPage(page);
17730 });
17731 $pager.appendTo($isotopePager);
17732 }
17733 $grid.after($isotopePager);
17734 })();
17735 }
17655 17736
17656 // use value of search field to filter 17737 // use value of search field to filter
17657 var $quicksearch = $('#quicksearch').keyup(debounce(function () { 17738 var $quicksearch = $('#quicksearch').keyup(debounce(function () {
17658 console.log($quicksearch.val()); 17739 console.log($quicksearch.val());
17659 qsRegex = new RegExp($quicksearch.val(), 'gi'); 17740 qsRegex = new RegExp($quicksearch.val(), 'gi');
17660 $grid.isotope(); 17741 $grid.isotope();
17742 updateFilterCounts();
17743 if ($('.grid.resources').length) {
17744 setPagination();
17745 goToPage(1);
17746 }
17661 }, 200)); 17747 }, 200));
17662 17748
17663 // debounce so filtering doesn't happen every millisecond 17749 // debounce so filtering doesn't happen every millisecond
...@@ -17734,7 +17820,7 @@ ...@@ -17734,7 +17820,7 @@
17734 } 17820 }
17735 $grid.isotope('layout'); 17821 $grid.isotope('layout');
17736 } 17822 }
17737 17823 if ($('.grid.course').length) {
17738 //**************************** 17824 //****************************
17739 // Isotope Load more button 17825 // Isotope Load more button
17740 //**************************** 17826 //****************************
...@@ -17788,6 +17874,7 @@ ...@@ -17788,6 +17874,7 @@
17788 span.toggleClass('glyphicon-chevron-up glyphicon-chevron-down'); 17874 span.toggleClass('glyphicon-chevron-up glyphicon-chevron-down');
17789 }); 17875 });
17790 } 17876 }
17877 }
17791 }); 17878 });
17792 17879
17793 // Add your custom JS here. 17880 // Add your custom JS here.
......
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
...@@ -7,14 +7,15 @@ jQueryBridget( 'isotope', Isotope, $ ); ...@@ -7,14 +7,15 @@ jQueryBridget( 'isotope', Isotope, $ );
7 jQuery( document ).ready(function($) { 7 jQuery( document ).ready(function($) {
8 8
9 9
10
10 if($('.grid').length){ 11 if($('.grid').length){
11 12
12 13
13 // quick search regex 14 // quick search regex
14 var qsRegex; 15 var qsRegex;
15 16 if($('.grid.course').length){
16 // init Isotope 17 // init Isotope
17 var $grid = $('.grid').isotope({ 18 var $grid = $('.grid.course').isotope({
18 itemSelector: '.element-item', 19 itemSelector: '.element-item',
19 layoutMode: 'fitRows', 20 layoutMode: 'fitRows',
20 getSortData: { 21 getSortData: {
...@@ -27,7 +28,124 @@ var $grid = $('.grid').isotope({ ...@@ -27,7 +28,124 @@ var $grid = $('.grid').isotope({
27 var buttonResult = filterValue ? $this.is( filterValue ) : true; 28 var buttonResult = filterValue ? $this.is( filterValue ) : true;
28 return filterText && buttonResult; 29 return filterText && buttonResult;
29 } 30 }
30 }); 31 });
32 }
33
34 if($('.grid.resources').length){
35
36 var $grid = $('.grid.resources').isotope({
37 itemSelector: '.element-item',
38 layoutMode: 'vertical',
39 getSortData: {
40 coursename: '.name',
41 date: '[data-ticks]',
42 },
43 filter: function() {
44 var $this = $(this);
45 var filterText = qsRegex ? $(this).text().match( qsRegex ) : true;
46 var buttonResult = filterValue ? $this.is( filterValue ) : true;
47 return filterText && buttonResult;
48 }
49 });
50
51 var itemsPerPageDefault = 5;
52 var itemsPerPage = defineItemsPerPage();
53 var itemSelector = '.element-item';
54 var currentNumberPages = 1;
55 var currentPage = 1;
56 var currentFilter = '*';
57 var filterAtribute = 'data-filter';
58 var pageAtribute = 'data-page';
59 var pagerClass = 'isotope-pager';
60
61 setPagination();
62 goToPage(1);
63
64 var responsiveIsotope = [
65 [480, 4],
66 [720, 6]
67 ];
68
69 }
70
71 function changeFilter(selector) {
72 $grid.isotope({
73 filter: selector
74 });
75 }
76
77 function getFilterSelector() {
78 var selector = itemSelector;
79 if (currentFilter != '*') {
80 selector += `[${filterAtribute}~="${currentFilter}"]`
81 }
82 return selector;
83 }
84
85
86 function goToPage(n) {
87 currentPage = n;
88
89 var selector = getFilterSelector();
90 selector += `[${pageAtribute}="${currentPage}"]`;
91
92 changeFilter(selector);
93 }
94
95 function defineItemsPerPage() {
96 var pages = itemsPerPageDefault;
97
98 return pages;
99 }
100
101 function setPagination() {
102
103 var SettingsPagesOnItems = function(){
104
105 var itemsLength = $grid.children(itemSelector).length;
106
107 var pages = Math.ceil(itemsLength / itemsPerPage);
108 var item = 1;
109 var page = 1;
110 var selector = getFilterSelector();
111
112 $grid.children(selector).each(function(){
113 if( item > itemsPerPage ) {
114 page++;
115 item = 1;
116 }
117 $(this).attr(pageAtribute, page);
118 item++;
119 });
120
121 currentNumberPages = page;
122
123 }();
124
125 var CreatePagers = function() {
126
127 var $isotopePager = ( $('.'+pagerClass).length == 0 ) ? $('<div class="'+pagerClass+'"></div>') : $('.'+pagerClass);
128
129 $isotopePager.html('');
130
131 for( var i = 0; i < currentNumberPages; i++ ) {
132 var $pager = $('<a href="javascript:void(0);" class="pager" '+pageAtribute+'="'+(i+1)+'"></a>');
133 $pager.html(i+1);
134
135 $pager.click(function(){
136 var page = $(this).eq(0).attr(pageAtribute);
137 goToPage(page);
138 });
139
140 $pager.appendTo($isotopePager);
141 }
142
143 $grid.after($isotopePager);
144
145 }();
146
147 }
148
31 149
32 150
33 151
...@@ -36,6 +154,11 @@ var $quicksearch = $('#quicksearch').keyup( debounce( function() { ...@@ -36,6 +154,11 @@ var $quicksearch = $('#quicksearch').keyup( debounce( function() {
36 console.log($quicksearch.val()); 154 console.log($quicksearch.val());
37 qsRegex = new RegExp( $quicksearch.val(), 'gi' ); 155 qsRegex = new RegExp( $quicksearch.val(), 'gi' );
38 $grid.isotope(); 156 $grid.isotope();
157 updateFilterCounts();
158 if($('.grid.resources').length){
159 setPagination();
160 goToPage(1);
161 }
39 }, 200 ) ); 162 }, 200 ) );
40 163
41 // debounce so filtering doesn't happen every millisecond 164 // debounce so filtering doesn't happen every millisecond
...@@ -126,7 +249,7 @@ function updateFilterCounts() { ...@@ -126,7 +249,7 @@ function updateFilterCounts() {
126 } 249 }
127 250
128 251
129 252 if($('.grid.course').length){
130 253
131 //**************************** 254 //****************************
132 // Isotope Load more button 255 // Isotope Load more button
...@@ -191,4 +314,6 @@ function updateFilterCounts() { ...@@ -191,4 +314,6 @@ function updateFilterCounts() {
191 }); 314 });
192 315
193 } 316 }
317
318 }
194 }); 319 });
......
...@@ -223,7 +223,7 @@ label[for=quicksearch]{ ...@@ -223,7 +223,7 @@ label[for=quicksearch]{
223 223
224 224
225 225
226 .course-list{ 226 .course-list:not(.resources){
227 .element-item { 227 .element-item {
228 position: relative; 228 position: relative;
229 float: left; 229 float: left;
...@@ -234,6 +234,17 @@ label[for=quicksearch]{ ...@@ -234,6 +234,17 @@ label[for=quicksearch]{
234 } 234 }
235 } 235 }
236 236
237 .course-list.resources{
238 .element-item {
239 position: relative;
240 float: left;
241 width: 100%;
242 height: 60px;
243 margin: 15px;
244 padding: 10px;
245 }
246 }
247
237 248
238 .view-plan{ 249 .view-plan{
239 width: 100%; 250 width: 100%;
...@@ -260,3 +271,9 @@ label[for=quicksearch]{ ...@@ -260,3 +271,9 @@ label[for=quicksearch]{
260 padding:0px!important; 271 padding:0px!important;
261 display:none; 272 display:none;
262 } 273 }
274
275
276 .isotope-pager .pager {
277 display: inline-block;
278 }
279
...\ No newline at end of file ...\ No newline at end of file
......