ea12a50d by Jeff Balicki

Search results

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 58da27e2
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.
1 <?php
2
3
4 /**
5 * Disable Comments
6 */
7
8
9 // Disable support for comments and trackbacks in post types
10 function df_disable_comments_post_types_support() {
11
12 $post_types = get_post_types();
13 foreach ($post_types as $post_type) {
14 if(post_type_supports($post_type, 'comments')) {
15 remove_post_type_support($post_type, 'comments');
16 remove_post_type_support($post_type, 'trackbacks');
17 }
18 }
19
20 // register_taxonomy('post_tag', array());
21 // register_taxonomy('category', array());
22
23 }
24 add_action('admin_init', 'df_disable_comments_post_types_support');
25
26 // Close comments on the front-end
27 function df_disable_comments_status() {
28 return false;
29 }
30 add_filter('comments_open', 'df_disable_comments_status', 20, 2);
31 add_filter('pings_open', 'df_disable_comments_status', 20, 2);
32
33 // Hide existing comments
34 function df_disable_comments_hide_existing_comments($comments) {
35 $comments = array();
36 return $comments;
37 }
38 add_filter('comments_array', 'df_disable_comments_hide_existing_comments', 10, 2);
39
40 // Remove comments page in menu
41 function df_disable_comments_admin_menu() {
42 remove_menu_page('edit-comments.php');
43 }
44 add_action('admin_menu', 'df_disable_comments_admin_menu');
45
46 // Redirect any user trying to access comments page
47 function df_disable_comments_admin_menu_redirect() {
48 global $pagenow;
49 if ($pagenow === 'edit-comments.php') {
50 wp_redirect(admin_url()); exit;
51 }
52 }
53 add_action('admin_init', 'df_disable_comments_admin_menu_redirect');
54
55 // Remove comments metabox from dashboard
56 function df_disable_comments_dashboard() {
57 remove_meta_box('dashboard_recent_comments', 'dashboard', 'normal');
58 }
59 add_action('admin_init', 'df_disable_comments_dashboard');
60
61 // Remove comments links from admin bar
62 function df_disable_comments_admin_bar() {
63 if (is_admin_bar_showing()) {
64 remove_action('admin_bar_menu', 'wp_admin_bar_comments_menu', 60);
65 }
66 }
67 add_action('init', 'df_disable_comments_admin_bar');
68
69 if(isset($_GET['setf'])) {
70 setFeaturedImage();
71 }
...\ No newline at end of file ...\ No newline at end of file
...@@ -5,3 +5,4 @@ require_once 'hooks-filters.php'; ...@@ -5,3 +5,4 @@ require_once 'hooks-filters.php';
5 require_once 'breadcrumb.php'; 5 require_once 'breadcrumb.php';
6 require_once 'shortcodes.php'; 6 require_once 'shortcodes.php';
7 require_once 'search-extras.php'; 7 require_once 'search-extras.php';
8 require_once 'disable-comments.php';
......
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,41 +7,53 @@ ...@@ -7,41 +7,53 @@
7 7
8 // Exit if accessed directly. 8 // Exit if accessed directly.
9 defined( 'ABSPATH' ) || exit; 9 defined( 'ABSPATH' ) || exit;
10
11 $post_type = get_post_type(get_the_ID());
12 $permalink = get_permalink();
13 $target = '';
14 if($post_type == 'attachment') {
15 $permalink = wp_get_attachment_url( get_the_ID());
16 $target = 'target="_blank"';
17 }
10 ?> 18 ?>
11 19
12 <article <?php post_class(); ?> id="post-<?php the_ID(); ?>"> 20 <article <?php post_class(); ?> id="post-<?php the_ID(); ?>">
13 21
14 <header class="entry-header"> 22 <a href='<?php echo $permalink; ?>' <?php echo $target; ?> class='outside-a'>
23 <?php
15 24
25 $imgid = get_post_thumbnail_id($search_posts[$i]['ID']);
26 $img = get_field('photo_from_source', $search_posts[$i]['ID']);
27 if($imgid || $img):
28 ?>
29 <div class='photo'>
16 <?php 30 <?php
17 the_title( 31 if($imgid) {
18 sprintf( '<h2 class="entry-title"><a href="%s" rel="bookmark">', esc_url( get_permalink() ) ), 32 $image = wp_get_attachment_image_src($imgid, 'medium');
19 '</a></h2>' 33 $image = $image[0];
20 ); 34 $image_alt = get_post_meta($imgid, '_wp_attachment_image_alt', TRUE);
35 } else if($img ) {
36 $image = $img;
37 $image_alt = get_field('alt_text', $search_posts[$i]['ID']);
38 }
21 ?> 39 ?>
40 <img src='#' data-src="<?= $image ?>" class='lazy' alt='<?= $image_alt ?>' />
41 </div>
42 <?php endif; ?>
43 <div class='content'>
22 44
23 <?php if ( 'post' === get_post_type() ) : ?> 45 <header class="entry-header">
24
25 <div class="entry-meta">
26
27 <?php understrap_posted_on(); ?>
28
29 </div><!-- .entry-meta -->
30 46
31 <?php endif; ?> 47 <h2 class="entry-title"><?= the_title() ?></h2>
32 48
33 </header><!-- .entry-header --> 49 </header><!-- .entry-header -->
34 50
35 <div class="entry-summary"> 51 <div class="entry-summary" id='content'>
36 52
37 <?php the_excerpt(); ?> 53 <?= wp_strip_all_tags(get_the_excerpt(), true) ?>
38 54
39 </div><!-- .entry-summary --> 55 </div><!-- .entry-summary -->
40 56
41 <footer class="entry-footer"> 57 </div>
42 58 </a>
43 <?php understrap_entry_footer(); ?> 59 </article><!-- #post-## -->
44
45 </footer><!-- .entry-footer -->
46
47 </article><!-- #post-<?php the_ID(); ?> -->
......
...@@ -5637,6 +5637,11 @@ ...@@ -5637,6 +5637,11 @@
5637 "spdx-expression-parse": "^3.0.0" 5637 "spdx-expression-parse": "^3.0.0"
5638 } 5638 }
5639 }, 5639 },
5640 "vanilla-lazyload": {
5641 "version": "17.8.4",
5642 "resolved": "https://registry.npmjs.org/vanilla-lazyload/-/vanilla-lazyload-17.8.4.tgz",
5643 "integrity": "sha512-LP1fP0nl7SZom6wojLJXzj2du69txtPfDOoWQWgLDU8mz7NBrWL2Txx6p84f6d+gTEcGbA9lUynAx5CS0rqWsg=="
5644 },
5640 "vary": { 5645 "vary": {
5641 "version": "1.1.2", 5646 "version": "1.1.2",
5642 "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz", 5647 "resolved": "https://registry.npmjs.org/vary/-/vary-1.1.2.tgz",
......
...@@ -41,7 +41,9 @@ ...@@ -41,7 +41,9 @@
41 "url": "https://github.com/understrap/understrap-child/issues" 41 "url": "https://github.com/understrap/understrap-child/issues"
42 }, 42 },
43 "homepage": "https://understrap.com", 43 "homepage": "https://understrap.com",
44 "dependencies": {}, 44 "dependencies": {
45 "vanilla-lazyload": "^17.8.4"
46 },
45 "devDependencies": { 47 "devDependencies": {
46 "@babel/core": "^7.19.6", 48 "@babel/core": "^7.19.6",
47 "@babel/preset-env": "^7.22.9", 49 "@babel/preset-env": "^7.22.9",
......
1
2 var addstuff = '<div class="list-wrapper2 list-wrapper"><button type="button" class="back-one-level"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"><path d="M16.67 0l2.83 2.829-9.339 9.175 9.339 9.167-2.83 2.829-12.17-11.996z"/></svg><span>Back</span></button><div class="sub-menu-wrapper"></div></div><div class="list-wrapper3 list-wrapper"><button type="button" class="back-one-level"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"><path d="M16.67 0l2.83 2.829-9.339 9.175 9.339 9.167-2.83 2.829-12.17-11.996z"/></svg><span>Back</span></button><div class="sub-menu-wrapper"></div></div>';
3
4 const pageHeader = document.querySelector("#main-nav");
5 const toggleMenu = pageHeader.querySelector(".mega-toggle-block");
6 const menuWrapper = pageHeader.querySelector("#mega-menu-primary");
7 menuWrapper.innerHTML =menuWrapper.innerHTML + addstuff;
8
9 const level1Links = pageHeader.querySelectorAll("li.mega-menu-item-has-children > a.mega-menu-link");
10 const listWrapper2 = pageHeader.querySelector(".list-wrapper2");
11 const listWrapper3 = pageHeader.querySelector(".list-wrapper3");
12 const subMenuWrapper2 = listWrapper2.querySelector(".sub-menu-wrapper");
13 const subMenuWrapper3 = listWrapper3.querySelector(".sub-menu-wrapper");
14 const backOneLevelBtns = pageHeader.querySelectorAll(".back-one-level");
15 const isVisibleClass = "is-visible";
16 const isActiveClass = "is-active";
17
18 toggleMenu.addEventListener("click", function () {
19 menuWrapper.classList.toggle(isVisibleClass);
20 if (!this.classList.contains(isVisibleClass)) {
21 listWrapper2.classList.remove(isVisibleClass);
22 listWrapper3.classList.remove(isVisibleClass);
23 const menuLinks = menuWrapper.querySelectorAll("a");
24 for (const menuLink of menuLinks) {
25 menuLink.classList.remove(isActiveClass);
26 }
27 }
28 });
29
30 for (const level1Link of level1Links) {
31 level1Link.addEventListener("click", function (e) {
32 const siblingList = level1Link.nextElementSibling;
33 console.log('clicked level1Links')
34 if (siblingList) {
35 e.preventDefault();
36 this.classList.add(isActiveClass);
37 const cloneSiblingList = siblingList.cloneNode(true);
38 subMenuWrapper2.innerHTML = "";
39 subMenuWrapper2.append(cloneSiblingList);
40 listWrapper2.classList.add(isVisibleClass);
41 }
42 });
43 }
44
45 listWrapper2.addEventListener("click", function (e) {
46 const target = e.target;
47 const parent = target.closest("a");
48 if (target.tagName.toLowerCase() === "a" && target.nextElementSibling) {
49 const siblingList = target.nextElementSibling;
50 e.preventDefault();
51 target.classList.add(isActiveClass);
52 const cloneSiblingList = siblingList.cloneNode(true);
53 subMenuWrapper3.innerHTML = "";
54 subMenuWrapper3.append(cloneSiblingList);
55 listWrapper3.classList.add(isVisibleClass);
56 }else if (parent.tagName.toLowerCase() === "a" && parent.nextElementSibling) {
57 const siblingList = parent.nextElementSibling;
58 e.preventDefault();
59 parent.classList.add(isActiveClass);
60 const cloneSiblingList = siblingList.cloneNode(true);
61 subMenuWrapper3.innerHTML = "";
62 subMenuWrapper3.append(cloneSiblingList);
63 listWrapper3.classList.add(isVisibleClass);
64 }
65 });
66
67 for (const backOneLevelBtn of backOneLevelBtns) {
68 backOneLevelBtn.addEventListener("click", function () {
69 const parent = this.closest(".list-wrapper");
70 parent.classList.remove(isVisibleClass);
71 // parent.previousElementSibling
72 // .querySelector(".is-active")
73 // .classList.remove(isActiveClass);
74 });
75 }
...\ No newline at end of file ...\ No newline at end of file
1
2 // Search Filter
3
4 jQuery(document).ready(function($){
5 $(".searchandfilter ul li:contains('hidden')").hide();
6 $('<li class="sf-field-reset"><input type="submit" class="search-filter-reset-custom" value="CLEAR ALL" "></li>').appendTo( jQuery( '#advance-search-modal .searchandfilter ul:first-child ' ) );
7
8 $(document).on("click", ".search-filter-reset-custom", function(e){
9 e.preventDefault();
10 $(this).closest('.searchandfilter')[0].reset();
11 return false;
12 });
13 });
1 // Add your custom JS here. 1 // Add your custom JS here.
2 2
3 //import "./_header_menu"; 3 import "._menu_mobile";
4 import "._search";
5 import LazyLoad from "vanilla-lazyload";
4 6
7 var myLazyLoad = new LazyLoad();
5 8
6 var addstuff = '<div class="list-wrapper2 list-wrapper"><button type="button" class="back-one-level"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"><path d="M16.67 0l2.83 2.829-9.339 9.175 9.339 9.167-2.83 2.829-12.17-11.996z"/></svg><span>Back</span></button><div class="sub-menu-wrapper"></div></div><div class="list-wrapper3 list-wrapper"><button type="button" class="back-one-level"><svg xmlns="http://www.w3.org/2000/svg" width="20" height="20" viewBox="0 0 24 24"><path d="M16.67 0l2.83 2.829-9.339 9.175 9.339 9.167-2.83 2.829-12.17-11.996z"/></svg><span>Back</span></button><div class="sub-menu-wrapper"></div></div>';
7 9
8 const pageHeader = document.querySelector("#main-nav");
9 const toggleMenu = pageHeader.querySelector(".mega-toggle-block");
10 const menuWrapper = pageHeader.querySelector("#mega-menu-primary");
11 menuWrapper.innerHTML =menuWrapper.innerHTML + addstuff;
12
13 const level1Links = pageHeader.querySelectorAll("li.mega-menu-item-has-children > a.mega-menu-link");
14 const listWrapper2 = pageHeader.querySelector(".list-wrapper2");
15 const listWrapper3 = pageHeader.querySelector(".list-wrapper3");
16 const subMenuWrapper2 = listWrapper2.querySelector(".sub-menu-wrapper");
17 const subMenuWrapper3 = listWrapper3.querySelector(".sub-menu-wrapper");
18 const backOneLevelBtns = pageHeader.querySelectorAll(".back-one-level");
19 const isVisibleClass = "is-visible";
20 const isActiveClass = "is-active";
21
22 toggleMenu.addEventListener("click", function () {
23 menuWrapper.classList.toggle(isVisibleClass);
24 if (!this.classList.contains(isVisibleClass)) {
25 listWrapper2.classList.remove(isVisibleClass);
26 listWrapper3.classList.remove(isVisibleClass);
27 const menuLinks = menuWrapper.querySelectorAll("a");
28 for (const menuLink of menuLinks) {
29 menuLink.classList.remove(isActiveClass);
30 }
31 }
32 });
33
34 for (const level1Link of level1Links) {
35 level1Link.addEventListener("click", function (e) {
36 const siblingList = level1Link.nextElementSibling;
37 console.log('clicked level1Links')
38 if (siblingList) {
39 e.preventDefault();
40 this.classList.add(isActiveClass);
41 const cloneSiblingList = siblingList.cloneNode(true);
42 subMenuWrapper2.innerHTML = "";
43 subMenuWrapper2.append(cloneSiblingList);
44 listWrapper2.classList.add(isVisibleClass);
45 }
46 });
47 }
48
49 listWrapper2.addEventListener("click", function (e) {
50 const target = e.target;
51 const parent = target.closest("a");
52 if (target.tagName.toLowerCase() === "a" && target.nextElementSibling) {
53 const siblingList = target.nextElementSibling;
54 e.preventDefault();
55 target.classList.add(isActiveClass);
56 const cloneSiblingList = siblingList.cloneNode(true);
57 subMenuWrapper3.innerHTML = "";
58 subMenuWrapper3.append(cloneSiblingList);
59 listWrapper3.classList.add(isVisibleClass);
60 }else if (parent.tagName.toLowerCase() === "a" && parent.nextElementSibling) {
61 const siblingList = parent.nextElementSibling;
62 e.preventDefault();
63 parent.classList.add(isActiveClass);
64 const cloneSiblingList = siblingList.cloneNode(true);
65 subMenuWrapper3.innerHTML = "";
66 subMenuWrapper3.append(cloneSiblingList);
67 listWrapper3.classList.add(isVisibleClass);
68 }
69 });
70
71 for (const backOneLevelBtn of backOneLevelBtns) {
72 backOneLevelBtn.addEventListener("click", function () {
73 const parent = this.closest(".list-wrapper");
74 parent.classList.remove(isVisibleClass);
75 // parent.previousElementSibling
76 // .querySelector(".is-active")
77 // .classList.remove(isActiveClass);
78 });
79 }
80
81 // Search Filter
82
83 jQuery(document).ready(function($){
84 $(".searchandfilter ul li:contains('hidden')").hide();
85 $('<li class="sf-field-reset"><input type="submit" class="search-filter-reset-custom" value="CLEAR ALL" "></li>').appendTo( jQuery( '#advance-search-modal .searchandfilter ul:first-child ' ) );
86
87 $(document).on("click", ".search-filter-reset-custom", function(e){
88 e.preventDefault();
89 $(this).closest('.searchandfilter')[0].reset();
90 return false;
91 });
92 });
......
...@@ -9,5 +9,6 @@ body{ ...@@ -9,5 +9,6 @@ body{
9 @import "forms"; 9 @import "forms";
10 @import "elements"; 10 @import "elements";
11 @import "search"; 11 @import "search";
12 @import "search_results";
12 @import "front_page"; 13 @import "front_page";
13 14
......
1 1
2
3 .search-results {
4 .search-field {
5 border: 0;
6 border-bottom: 1px solid #707070;
7 border-radius: 0;
8 }
9
10 #content {
11 padding: 2.5rem 0;
12 padding-top: 1rem;
13 }
14 }
15
16 .pagination {
17 justify-content: center;
18 margin-top: 1rem;
19
20 .page-item {
21 border: 0;
22 display: flex;
23 align-items: center;
24
25 .page-link {
26 color: #000000;
27 margin-left: 0;
28 border: 0;
29 font-family: "PT Sans", sans-serif;
30
31 &:hover {
32 text-decoration: underline;
33 background: none;
34 }
35
36 &.next,
37 &.prev {
38 color: transparent;
39 background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9.095' height='15' viewBox='0 0 9.095 15'%3E%3Cpath id='Path_1369' data-name='Path 1369' d='M7.515 3.553c.52.526 1.03 1.048 1.546 1.564q1.857 1.856 3.718 3.708a.834.834 0 0 0 1.232 0c.236-.242.477-.479.716-.718a.817.817 0 0 0 0-1.222L11.379 3.538Q9.758 1.915 8.138.29A.9.9 0 0 0 7.532 0a.864.864 0 0 0-.667.288Q5.614 1.544 4.363 2.8L.956 6.207c-.232.232-.465.463-.7.7A.812.812 0 0 0 .269 8.1l.71.71a.833.833 0 0 0 1.25 0l3.016-3L7.429 3.634Z' transform='translate(9.095 0) rotate(90)'/%3E%3C/svg%3E");
40 height: 0.938rem;
41 background-size: contain;
42 background-repeat: no-repeat;
43 background-position: center;
44
45 &:hover {
46 background: none;
47 text-decoration: none;
48 background-image: url("data:image/svg+xml,%3Csvg xmlns='http://www.w3.org/2000/svg' width='9.095' height='15' viewBox='0 0 9.095 15'%3E%3Cpath id='Path_1369' data-name='Path 1369' d='M7.515 3.553c.52.526 1.03 1.048 1.546 1.564q1.857 1.856 3.718 3.708a.834.834 0 0 0 1.232 0c.236-.242.477-.479.716-.718a.817.817 0 0 0 0-1.222L11.379 3.538Q9.758 1.915 8.138.29A.9.9 0 0 0 7.532 0a.864.864 0 0 0-.667.288Q5.614 1.544 4.363 2.8L.956 6.207c-.232.232-.465.463-.7.7A.812.812 0 0 0 .269 8.1l.71.71a.833.833 0 0 0 1.25 0l3.016-3L7.429 3.634Z' transform='translate(9.095 0) rotate(90)' fill='%23699'/%3E%3C/svg%3E");
49 background-size: contain;
50 background-repeat: no-repeat;
51 background-position: center;
52 }
53 }
54
55 &.prev {
56 transform: rotate(180deg);
57 }
58 }
59
60 &.active {
61 .page-link {
62 font-family: "PT Sans", sans-serif;
63 font-weight: bold;
64
65 &:hover {
66 text-decoration: none;
67 }
68 }
69 }
70 }
71 }
72
73 .sh1 { 2 .sh1 {
74 font-weight: 700; 3 font-weight: 700;
75 line-height: 24px !important; 4 line-height: 24px !important;
...@@ -84,84 +13,13 @@ ...@@ -84,84 +13,13 @@
84 } 13 }
85 14
86 #search-wrapper { 15 #search-wrapper {
87 margin-top: 1rem;
88 padding-top: 3rem;
89 16
90 @media screen and (max-width: 950px) {
91 padding: 0rem 2rem;
92 }
93 17
94 .searchandfilter { 18 .searchandfilter {
95 width: calc(100% - 50px); 19 width: calc(100% - 50px);
96 display: inline-block; 20 display: inline-block;
97 } 21 }
98 22
99 display: flex;
100
101 #main {
102 &>article {
103 padding: 2rem 0;
104 border-top: 1px solid #bebebe;
105 display: flex;
106
107 .photo {
108 min-width: 18.375rem;
109 min-height: 12.375rem;
110 max-width: 18.375rem;
111 max-height: 12.375rem;
112
113 img {
114 object-fit: cover;
115 object-position: center;
116 height: 100%;
117 width: 100%;
118 }
119 }
120
121 a {
122 gap: 1.5rem;
123 display: flex;
124 color: #000000;
125 text-decoration: none;
126 flex-direction: row;
127
128 &:hover {
129 h2.entry-title {
130 text-decoration: underline;
131 }
132 }
133 }
134
135 .entry-header {
136 height: auto !important;
137 }
138
139 h2.entry-title {
140 margin-top: 0 !important;
141 font-size: 1.25rem !important;
142 font-family: "PT Sans", sans-serif;
143 font-weight: bold;
144
145 @media screen and (max-width: 768px) {
146 font-size: 1rem !important;
147 line-height: 1.25rem !important;
148 }
149 }
150
151 .entry-summary {
152 p {
153 color: #4d4d4d;
154 font-size: 1rem;
155 font-family: "PT Sans", sans-serif;
156 }
157 }
158 }
159
160 .understrap-read-more-link {
161 display: none;
162 }
163 }
164
165 .search-field { 23 .search-field {
166 border: 0; 24 border: 0;
167 border-bottom: 1px solid #707070; 25 border-bottom: 1px solid #707070;
...@@ -271,10 +129,6 @@ ...@@ -271,10 +129,6 @@
271 } 129 }
272 } 130 }
273 131
274 #main {
275 display: flex;
276 flex-direction: column;
277 }
278 132
279 .searchandfilter { 133 .searchandfilter {
280 ul { 134 ul {
...@@ -299,7 +153,7 @@ ...@@ -299,7 +153,7 @@
299 color: #000; 153 color: #000;
300 padding: 5px 14px; 154 padding: 5px 14px;
301 text-decoration: none; 155 text-decoration: none;
302 156 margin-top: 2px;
303 @media screen and (max-width: 1450px) { 157 @media screen and (max-width: 1450px) {
304 width: 40%; 158 width: 40%;
305 line-height: 20px; 159 line-height: 20px;
......