4314b649 by Jeff Balicki

qa

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 788ba311
Showing 32 changed files with 132 additions and 38 deletions
...@@ -88,7 +88,9 @@ foreach($posts as $post ) { ...@@ -88,7 +88,9 @@ foreach($posts as $post ) {
88 $image_alt = get_post_meta($imgid, '_wp_attachment_image_alt', TRUE); 88 $image_alt = get_post_meta($imgid, '_wp_attachment_image_alt', TRUE);
89 }else{ 89 }else{
90 $image = wp_get_attachment_image_src($post->ID, 'medium'); 90 $image = wp_get_attachment_image_src($post->ID, 'medium');
91 if(isset($image[0])){
91 $image = $image[0]; 92 $image = $image[0];
93 }
92 $image_alt = get_post_meta($post->ID, '_wp_attachment_image_alt', TRUE); 94 $image_alt = get_post_meta($post->ID, '_wp_attachment_image_alt', TRUE);
93 } 95 }
94 $term_list = array(); 96 $term_list = array();
...@@ -101,6 +103,9 @@ foreach($posts as $post ) { ...@@ -101,6 +103,9 @@ foreach($posts as $post ) {
101 if($term_list == 'PDF'){ 103 if($term_list == 'PDF'){
102 $image =""; 104 $image ="";
103 } 105 }
106 if(is_array($term_list)){
107 $term_list = implode(" ", $term_list);
108 }
104 109
105 if($post_type == 'documents'){ $link = get_post_meta($post->ID, 'document_link', true );}; 110 if($post_type == 'documents'){ $link = get_post_meta($post->ID, 'document_link', true );};
106 echo '<tr><td><div class="rel"><a target="_blank" class="'.$term_list.'" href="'.$link.'">'; 111 echo '<tr><td><div class="rel"><a target="_blank" class="'.$term_list.'" href="'.$link.'">';
......
...@@ -16284,6 +16284,8 @@ input[type=radio]:checked::before { ...@@ -16284,6 +16284,8 @@ input[type=radio]:checked::before {
16284 16284
16285 body { 16285 body {
16286 font-family: "PT Sans", sans-serif; 16286 font-family: "PT Sans", sans-serif;
16287 overflow-y: scroll !important;
16288 padding-right: 0px !important;
16287 } 16289 }
16288 16290
16289 * { 16291 * {
......
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.
...@@ -151,3 +151,80 @@ function getName() { ...@@ -151,3 +151,80 @@ function getName() {
151 return $randomString; 151 return $randomString;
152 } 152 }
153 153
154
155 function en_fr_date($date)
156 {
157 error_log($date);
158 $my_current_lang = apply_filters( 'wpml_current_language', NULL );
159 if($my_current_lang == 'fr'){
160 return convert_date_fr(date('j F Y', $date), 'j F Y');
161 } else {
162 return date('F j, Y', $date);
163 }
164 }
165
166
167 function convert_date_fr($date, $format_in = 'j F Y') {
168 error_log($date);
169
170 $months = array(
171 'january' => 'janvier',
172 'february' => 'février',
173 'march' => 'mars',
174 'april' => 'avril',
175 'may' => 'mai' ,
176 'june' => 'juin' ,
177 'july' => 'juillet',
178 'august' => 'août',
179 'september' => 'septembre',
180 'october' => 'octobre',
181 'november' => 'novembre',
182 'december' => 'décembre',
183 );
184
185 // List of available formats for date
186 $formats_list = array('d','D','j','l','N','S','w','z','S','W','M','F','m','M','n','t','A','L','o','Y','y','H','a','A','B','g','G','h','H','i','s','u','v','F','e','I','O','P','T','Z','D','c','r','U');
187
188 // We get separators between elements in $date, based on $format_in
189 $split = str_split($format_in);
190 $separators = array();
191 $_continue = false;
192 foreach($split as $k => $s) {
193 if($_continue) {
194 $_continue = false;
195 continue;
196 }
197 // For escaped chars (like "\h")
198 if($s == '\\' && isset($split[$k+1])) {
199 $separators[] = '\\' . $split[$k+1];
200 $_continue = true;
201 continue;
202 }
203 if(!in_array($s, $formats_list)) {
204 $separators[] = $s;
205 }
206 }
207
208 // Translate month name
209 $tmp = preg_split('/('.implode('|', array_map(function($v) {
210 if($v == '/') {
211 return '\/';
212 }
213 return str_replace('\\', '\\\\', $v);
214 }, $separators)).')/', $date);
215
216 foreach($tmp as $k => $v) {
217 $v = mb_strtolower($v, 'UTF-8');
218 if(isset($months[$v])) {
219 $tmp[$k] = $months[$v];
220 }
221 }
222
223 // Re-construct the date
224 $imploded = '';
225 foreach($tmp as $k => $v) {
226 $imploded .= $v . (isset($separators[$k]) ? str_replace('\\', '', $separators[$k]) : '');
227 }
228 error_log($imploded);
229 return $imploded;
230 }
...\ No newline at end of file ...\ No newline at end of file
......
...@@ -37,7 +37,7 @@ $navbar_type = get_theme_mod( 'understrap_navbar_type', 'collapse' ); ...@@ -37,7 +37,7 @@ $navbar_type = get_theme_mod( 'understrap_navbar_type', 'collapse' );
37 <body <?php body_class($xtra_classes); ?> <?php understrap_body_attributes(); ?> data-scroll-offset="50"> 37 <body <?php body_class($xtra_classes); ?> <?php understrap_body_attributes(); ?> data-scroll-offset="50">
38 <?php do_action( 'wp_body_open' ); ?> 38 <?php do_action( 'wp_body_open' ); ?>
39 39
40 <?= $alert_banner ?> 40
41 41
42 42
43 <div class="site" id="page"> 43 <div class="site" id="page">
......

840 Bytes | W: | H:

840 Bytes | W: | H:

  • 2-up
  • Swipe
  • Onion skin

1.07 KB | W: | H:

1.07 KB | W: | H:

  • 2-up
  • Swipe
  • Onion skin
...@@ -5,14 +5,14 @@ function pull_posts_for_post_list( $data ) { ...@@ -5,14 +5,14 @@ function pull_posts_for_post_list( $data ) {
5 $request_uri = sanitize_text_field($_SERVER['REQUEST_URI']); 5 $request_uri = sanitize_text_field($_SERVER['REQUEST_URI']);
6 $request_uri = base64_encode($request_uri); 6 $request_uri = base64_encode($request_uri);
7 7
8 $BYPASS_CACHE = false; 8 // $BYPASS_CACHE = false;
9 $client = new Predis\Client(); 9 // $client = new Predis\Client();
10 10
11 if(!$BYPASS_CACHE) { 11 // if(!$BYPASS_CACHE) {
12 if($client->exists($request_uri)) { 12 // if($client->exists($request_uri)) {
13 return unserialize($client->get($request_uri)); 13 // return unserialize($client->get($request_uri));
14 } 14 // }
15 } 15 // }
16 16
17 $categories = sanitize_textarea_field($_REQUEST['categories']); 17 $categories = sanitize_textarea_field($_REQUEST['categories']);
18 $segment = trim(sanitize_textarea_field($_REQUEST['segment'])); 18 $segment = trim(sanitize_textarea_field($_REQUEST['segment']));
...@@ -57,21 +57,22 @@ function pull_posts_for_post_list( $data ) { ...@@ -57,21 +57,22 @@ function pull_posts_for_post_list( $data ) {
57 $article_author = get_field('article_author', $post->ID) ?: null; 57 $article_author = get_field('article_author', $post->ID) ?: null;
58 $author_title = get_field('author_title', $post->ID) ?: null; 58 $author_title = get_field('author_title', $post->ID) ?: null;
59 $author_company = get_field('author_company', $post->ID) ?: null; 59 $author_company = get_field('author_company', $post->ID) ?: null;
60 60 $img_id = get_post_thumbnail_id( $post->ID);
61 $alt = get_post($img_id)->post_excerpt;
61 $img = get_the_post_thumbnail_url($post, 'medium'); 62 $img = get_the_post_thumbnail_url($post, 'medium');
62 63 error_log('$alt');
64 error_log($alt);
63 if(!$img) { 65 if(!$img) {
64 $img = get_post_meta($post->ID, 'photo_from_source', true); 66 $img = get_post_meta($post->ID, 'photo_from_source', true);
65 } 67 }
66 68 $new_posts[] = ['date'=>en_fr_date( get_post_timestamp($post->ID)),
67 $new_posts[] = ['date'=>date_i18n( ' F j, Y', get_post_timestamp($post->ID)),
68 'article_author'=>$article_author,'author_title'=>$author_title, 69 'article_author'=>$article_author,'author_title'=>$author_title,
69 'author_company'=>$author_company,'href'=>get_permalink($post),'title'=>$post->post_title, 70 'author_company'=>$author_company,'href'=>get_permalink($post),'title'=>$post->post_title,
70 'text'=>$excerpt,'img_src'=>$img]; 71 'text'=>$excerpt,'img_src'=>$img,'img_alt'=>$alt];
71 72
72 } 73 }
73 74
74 $client->set($request_uri, serialize(['posts'=>$new_posts,'last_index'=>0]), 'ex', 3600); 75 //$client->set($request_uri, serialize(['posts'=>$new_posts,'last_index'=>0]), 'ex', 3600);
75 76
76 return ['posts'=>$new_posts,'last_index'=>0]; 77 return ['posts'=>$new_posts,'last_index'=>0];
77 78
...@@ -115,16 +116,21 @@ function pull_posts_for_post_list( $data ) { ...@@ -115,16 +116,21 @@ function pull_posts_for_post_list( $data ) {
115 $article_author = get_field('article_author', $post->ID) ?: null; 116 $article_author = get_field('article_author', $post->ID) ?: null;
116 $author_title = get_field('author_title', $post->ID) ?: null; 117 $author_title = get_field('author_title', $post->ID) ?: null;
117 $author_company = get_field('author_company', $post->ID) ?: null; 118 $author_company = get_field('author_company', $post->ID) ?: null;
118 119 $img_id = get_post_thumbnail_id( $post->ID);
120 $alt = get_post($img_id)->post_excerpt;
121 error_log('$alt');
122 error_log($alt);
119 $img = get_the_post_thumbnail_url($post, 'medium_large'); 123 $img = get_the_post_thumbnail_url($post, 'medium_large');
120 124
121 if(!$img) { 125 if(!$img) {
122 $img = get_post_meta($post->ID, 'photo_from_source', true); 126 $img = get_post_meta($post->ID, 'photo_from_source', true);
123 } 127 }
124 $posts[] = ['date'=>date_i18n( ' F j, Y', get_post_timestamp($post->ID)), 128
129
130 $posts[] = ['date'=>en_fr_date( get_post_timestamp($post->ID)),
125 'article_author'=>$article_author,'author_title'=>$author_title, 131 'article_author'=>$article_author,'author_title'=>$author_title,
126 'author_company'=>$author_company,'href'=>get_permalink($post),'title'=>$post->post_title, 132 'author_company'=>$author_company,'href'=>get_permalink($post),'title'=>$post->post_title,
127 'text'=>$excerpt,'img_src'=>$img]; 133 'text'=>$excerpt,'img_src'=>$img,'img_alt'=>$alt];
128 134
129 } 135 }
130 136
...@@ -133,7 +139,7 @@ function pull_posts_for_post_list( $data ) { ...@@ -133,7 +139,7 @@ function pull_posts_for_post_list( $data ) {
133 $last_index = true; 139 $last_index = true;
134 } 140 }
135 141
136 $client->set($request_uri, serialize(['posts'=>$posts,'last_index'=>$last_index]), 'ex', 3600); 142 //$client->set($request_uri, serialize(['posts'=>$posts,'last_index'=>$last_index]), 'ex', 3600);
137 143
138 return ['posts'=>$posts,'last_index'=>$last_index]; 144 return ['posts'=>$posts,'last_index'=>$last_index];
139 145
......
...@@ -17,7 +17,7 @@ add_action( 'init' , 'wptp_add_tags_to_attachments' ); ...@@ -17,7 +17,7 @@ add_action( 'init' , 'wptp_add_tags_to_attachments' );
17 17
18 18
19 19
20 add_action('init','set_exclude_from_search'); 20 //add_action('init','set_exclude_from_search');
21 function set_exclude_from_search() 21 function set_exclude_from_search()
22 { 22 {
23 if ($_GET['var'] =='set_wpml_from_search') { 23 if ($_GET['var'] =='set_wpml_from_search') {
...@@ -41,7 +41,7 @@ function set_exclude_from_search() ...@@ -41,7 +41,7 @@ function set_exclude_from_search()
41 } 41 }
42 } 42 }
43 43
44 add_action('init','delete_exclude_from_search'); 44 //add_action('init','delete_exclude_from_search');
45 function delete_exclude_from_search() 45 function delete_exclude_from_search()
46 { 46 {
47 if ($_GET['var'] =='delete_wpml_from_search') { 47 if ($_GET['var'] =='delete_wpml_from_search') {
...@@ -58,7 +58,7 @@ function delete_exclude_from_search() ...@@ -58,7 +58,7 @@ function delete_exclude_from_search()
58 58
59 } 59 }
60 60
61 add_action('init','update_tax_counts'); 61 //add_action('init','update_tax_counts');
62 function update_tax_counts() 62 function update_tax_counts()
63 { 63 {
64 if ($_GET['var'] =='update_tax_counts') { 64 if ($_GET['var'] =='update_tax_counts') {
......
...@@ -20670,7 +20670,7 @@ ...@@ -20670,7 +20670,7 @@
20670 if (size == 2) { 20670 if (size == 2) {
20671 li += "<li class='article-card lg'><a href='" + post_obj['href'] + "'>"; 20671 li += "<li class='article-card lg'><a href='" + post_obj['href'] + "'>";
20672 if (post_obj['img_src']) { 20672 if (post_obj['img_src']) {
20673 li += "<div class='image large'><div class='scale-wrapper'><img width='500' height='340' src='" + post_obj['img_src'] + "' /></div></div>"; 20673 li += "<div class='image large'><div class='scale-wrapper'><img width='500' height='340' src='" + post_obj['img_src'] + "' alt='" + post_obj['img_alt'] + "'/></div></div>";
20674 } 20674 }
20675 if (post_obj['title'].length > 100) { 20675 if (post_obj['title'].length > 100) {
20676 li += "<div class='content reduce'><span class='news-title'>" + post_obj['title'] + "</span></div>"; 20676 li += "<div class='content reduce'><span class='news-title'>" + post_obj['title'] + "</span></div>";
...@@ -20687,7 +20687,7 @@ ...@@ -20687,7 +20687,7 @@
20687 } else { 20687 } else {
20688 li += "<li class='article-card sm'><a href='" + post_obj['href'] + "'>"; 20688 li += "<li class='article-card sm'><a href='" + post_obj['href'] + "'>";
20689 if (post_obj['img_src']) { 20689 if (post_obj['img_src']) {
20690 li += "<div class='image'><div class='scale-wrapper'><img width='215' height='140' src='" + post_obj['img_src'] + "' /></div></div>"; 20690 li += "<div class='image'><div class='scale-wrapper'><img width='215' height='140' src='" + post_obj['img_src'] + "' alt='" + post_obj['img_alt'] + "' /></div></div>";
20691 } 20691 }
20692 if (post_obj['title'].length > 100) { 20692 if (post_obj['title'].length > 100) {
20693 li += "<div class='content reduce'><span class='news-title'>" + post_obj['title'] + "</span>"; 20693 li += "<div class='content reduce'><span class='news-title'>" + post_obj['title'] + "</span>";
......
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.
...@@ -8,10 +8,8 @@ ...@@ -8,10 +8,8 @@
8 // Exit if accessed directly. 8 // Exit if accessed directly.
9 defined( 'ABSPATH' ) || exit; 9 defined( 'ABSPATH' ) || exit;
10 10
11 11 $img ="";
12 $imgid = get_post_thumbnail_id($search_posts[$i]['ID']); 12 $imgid = get_post_thumbnail_id();
13 $img = "";
14
15 $post_type = get_post_type(get_the_ID()); 13 $post_type = get_post_type(get_the_ID());
16 $permalink = get_permalink(); 14 $permalink = get_permalink();
17 $target = ''; 15 $target = '';
...@@ -78,7 +76,7 @@ if ( !empty( $terms ) && !is_wp_error( $terms ) ){ ...@@ -78,7 +76,7 @@ if ( !empty( $terms ) && !is_wp_error( $terms ) ){
78 76
79 </header><!-- .entry-header --> 77 </header><!-- .entry-header -->
80 78
81 <div class="entry-summary" id='content'> 79 <div class="entry-summary" >
82 80
83 <?= str_replace("[...]Read More...", "",wp_strip_all_tags($excerpt, true)); ?> 81 <?= str_replace("[...]Read More...", "",wp_strip_all_tags($excerpt, true)); ?>
84 82
......
...@@ -50,10 +50,6 @@ if ($thumbnail_image && isset($thumbnail_image[0])) { ...@@ -50,10 +50,6 @@ if ($thumbnail_image && isset($thumbnail_image[0])) {
50 <div class="breadcrumb"><?php get_breadcrumb(); ?></div> 50 <div class="breadcrumb"><?php get_breadcrumb(); ?></div>
51 <?php the_field('header_text'); ?> 51 <?php the_field('header_text'); ?>
52 </div> 52 </div>
53 <?php if($badge){
54 $badge_content = get_field('badge_content');
55 echo "<div class='badge'><span>".$badge_content['badge_label']."</span><div class='badge_content'><p>".$badge_content['badge_text']."</p></div></div>";
56 }?>
57 </div> 53 </div>
58 54
59 </div> 55 </div>
......
...@@ -9,7 +9,10 @@ ...@@ -9,7 +9,10 @@
9 defined( 'ABSPATH' ) || exit; 9 defined( 'ABSPATH' ) || exit;
10 10
11 get_header(); 11 get_header();
12 12 $search='';
13 if(isset($_GET["_sf_s"])){
14 $search = $_GET["_sf_s"];
15 }
13 ?> 16 ?>
14 17
15 <div class="wrapper" id="search-wrapper"> 18 <div class="wrapper" id="search-wrapper">
...@@ -19,7 +22,8 @@ get_header(); ...@@ -19,7 +22,8 @@ get_header();
19 <?php //get_search_form() ?> 22 <?php //get_search_form() ?>
20 <div class="top-search"> 23 <div class="top-search">
21 <li class="sf-field-search"><label> 24 <li class="sf-field-search"><label>
22 <input placeholder="<?php _e('Search …','msf');?>" id="top-search" class="sf-input-text" type="text" value="<?php echo $_GET["_sf_s"]; ?>" title=""></label></li> 25 <span class="screen-reader-text">Search</span>
26 <input placeholder="<?php _e('Search …','msf');?>" id="top-search" class="sf-input-text" type="text" value="<?php echo $search; ?>" title=""></label></li>
23 <li class="sf-field-submit"><input type="submit" class="top-go" value="<?php _e('GO','msf'); ?>"><?php echo do_shortcode('[advance-search search_id="advanced-search"]'); ?></li> 27 <li class="sf-field-submit"><input type="submit" class="top-go" value="<?php _e('GO','msf'); ?>"><?php echo do_shortcode('[advance-search search_id="advanced-search"]'); ?></li>
24 </div> 28 </div>
25 <button class="btn btn-primary filter" data-bs-toggle="collapse" data-bs-target="#search-sidebar" role="button" aria-expanded="false" aria-controls="search-sidebar" > 29 <button class="btn btn-primary filter" data-bs-toggle="collapse" data-bs-target="#search-sidebar" role="button" aria-expanded="false" aria-controls="search-sidebar" >
......
...@@ -22,7 +22,11 @@ if ($thumbnail_image && isset($thumbnail_image[0])) { ...@@ -22,7 +22,11 @@ if ($thumbnail_image && isset($thumbnail_image[0])) {
22 $photo_caption = $thumbnail_image[0]->post_excerpt; 22 $photo_caption = $thumbnail_image[0]->post_excerpt;
23 $img_alt = get_post_meta($post_thumbnail_id , '_wp_attachment_image_alt', true); 23 $img_alt = get_post_meta($post_thumbnail_id , '_wp_attachment_image_alt', true);
24 $img_title = $thumbnail_image[0]->post_title; 24 $img_title = $thumbnail_image[0]->post_title;
25 $copy = $thumbnail_image[0]->post_title; 25 $copy = get_field('copy', $post_thumbnail_id );
26 if(!$copy){
27 $en_post_thumbnail_id = apply_filters( 'wpml_object_id', $post_thumbnail_id , 'attachment', FALSE, 'en' );
28 $copy = get_field('copy', $en_post_thumbnail_id );
29 }
26 30
27 } 31 }
28 32
......
...@@ -7,7 +7,7 @@ function postItem(post_obj, size, sides, side_index, side_alternate, labels) { ...@@ -7,7 +7,7 @@ function postItem(post_obj, size, sides, side_index, side_alternate, labels) {
7 if(size == 2) { 7 if(size == 2) {
8 li += "<li class='article-card lg'><a href='"+post_obj['href']+"'>"; 8 li += "<li class='article-card lg'><a href='"+post_obj['href']+"'>";
9 if(post_obj['img_src']) { 9 if(post_obj['img_src']) {
10 li += "<div class='image large'><div class='scale-wrapper'><img width='500' height='340' src='"+post_obj['img_src']+"' /></div></div>"; 10 li += "<div class='image large'><div class='scale-wrapper'><img width='500' height='340' src='"+post_obj['img_src']+"' alt='"+post_obj['img_alt']+"'/></div></div>";
11 } 11 }
12 if(post_obj['title'].length > 100) { 12 if(post_obj['title'].length > 100) {
13 li += "<div class='content reduce'><span class='news-title'>"+post_obj['title']+"</span></div>"; 13 li += "<div class='content reduce'><span class='news-title'>"+post_obj['title']+"</span></div>";
...@@ -24,7 +24,7 @@ function postItem(post_obj, size, sides, side_index, side_alternate, labels) { ...@@ -24,7 +24,7 @@ function postItem(post_obj, size, sides, side_index, side_alternate, labels) {
24 } else { 24 } else {
25 li += "<li class='article-card sm'><a href='"+post_obj['href']+"'>"; 25 li += "<li class='article-card sm'><a href='"+post_obj['href']+"'>";
26 if(post_obj['img_src']) { 26 if(post_obj['img_src']) {
27 li += "<div class='image'><div class='scale-wrapper'><img width='215' height='140' src='"+post_obj['img_src']+"' /></div></div>"; 27 li += "<div class='image'><div class='scale-wrapper'><img width='215' height='140' src='"+post_obj['img_src']+"' alt='"+post_obj['img_alt']+"' /></div></div>";
28 } 28 }
29 if(post_obj['title'].length > 100) { 29 if(post_obj['title'].length > 100) {
30 li += "<div class='content reduce'><span class='news-title'>"+post_obj['title']+"</span>"; 30 li += "<div class='content reduce'><span class='news-title'>"+post_obj['title']+"</span>";
......
...@@ -2,6 +2,8 @@ ...@@ -2,6 +2,8 @@
2 body { 2 body {
3 3
4 font-family: "PT Sans",sans-serif; 4 font-family: "PT Sans",sans-serif;
5 overflow-y: scroll !important;
6 padding-right: 0px !important;
5 7
6 } 8 }
7 9
......
...@@ -2,5 +2,5 @@ ...@@ -2,5 +2,5 @@
2 Theme Name: MSF CA Child 2 Theme Name: MSF CA Child
3 Author: Tenzing Communications 3 Author: Tenzing Communications
4 Template: msf-ca 4 Template: msf-ca
5 Version: 1.0.60 5 Version: 1.0.61
6 */ 6 */
...\ No newline at end of file ...\ No newline at end of file
......