4314b649 by Jeff Balicki

qa

Signed-off-by: Jeff <jeff@gotenzing.com>
1 parent 788ba311
Showing 32 changed files with 133 additions and 39 deletions
......@@ -88,7 +88,9 @@ foreach($posts as $post ) {
$image_alt = get_post_meta($imgid, '_wp_attachment_image_alt', TRUE);
}else{
$image = wp_get_attachment_image_src($post->ID, 'medium');
$image = $image[0];
if(isset($image[0])){
$image = $image[0];
}
$image_alt = get_post_meta($post->ID, '_wp_attachment_image_alt', TRUE);
}
$term_list = array();
......@@ -101,6 +103,9 @@ foreach($posts as $post ) {
if($term_list == 'PDF'){
$image ="";
}
if(is_array($term_list)){
$term_list = implode(" ", $term_list);
}
if($post_type == 'documents'){ $link = get_post_meta($post->ID, 'document_link', true );};
echo '<tr><td><div class="rel"><a target="_blank" class="'.$term_list.'" href="'.$link.'">';
......
......@@ -16284,6 +16284,8 @@ input[type=radio]:checked::before {
body {
font-family: "PT Sans", sans-serif;
overflow-y: scroll !important;
padding-right: 0px !important;
}
* {
......
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() {
return $randomString;
}
function en_fr_date($date)
{
error_log($date);
$my_current_lang = apply_filters( 'wpml_current_language', NULL );
if($my_current_lang == 'fr'){
return convert_date_fr(date('j F Y', $date), 'j F Y');
} else {
return date('F j, Y', $date);
}
}
function convert_date_fr($date, $format_in = 'j F Y') {
error_log($date);
$months = array(
'january' => 'janvier',
'february' => 'février',
'march' => 'mars',
'april' => 'avril',
'may' => 'mai' ,
'june' => 'juin' ,
'july' => 'juillet',
'august' => 'août',
'september' => 'septembre',
'october' => 'octobre',
'november' => 'novembre',
'december' => 'décembre',
);
// List of available formats for date
$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');
// We get separators between elements in $date, based on $format_in
$split = str_split($format_in);
$separators = array();
$_continue = false;
foreach($split as $k => $s) {
if($_continue) {
$_continue = false;
continue;
}
// For escaped chars (like "\h")
if($s == '\\' && isset($split[$k+1])) {
$separators[] = '\\' . $split[$k+1];
$_continue = true;
continue;
}
if(!in_array($s, $formats_list)) {
$separators[] = $s;
}
}
// Translate month name
$tmp = preg_split('/('.implode('|', array_map(function($v) {
if($v == '/') {
return '\/';
}
return str_replace('\\', '\\\\', $v);
}, $separators)).')/', $date);
foreach($tmp as $k => $v) {
$v = mb_strtolower($v, 'UTF-8');
if(isset($months[$v])) {
$tmp[$k] = $months[$v];
}
}
// Re-construct the date
$imploded = '';
foreach($tmp as $k => $v) {
$imploded .= $v . (isset($separators[$k]) ? str_replace('\\', '', $separators[$k]) : '');
}
error_log($imploded);
return $imploded;
}
\ No newline at end of file
......
......@@ -37,7 +37,7 @@ $navbar_type = get_theme_mod( 'understrap_navbar_type', 'collapse' );
<body <?php body_class($xtra_classes); ?> <?php understrap_body_attributes(); ?> data-scroll-offset="50">
<?php do_action( 'wp_body_open' ); ?>
<?= $alert_banner ?>
<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 ) {
$request_uri = sanitize_text_field($_SERVER['REQUEST_URI']);
$request_uri = base64_encode($request_uri);
$BYPASS_CACHE = false;
$client = new Predis\Client();
// $BYPASS_CACHE = false;
// $client = new Predis\Client();
if(!$BYPASS_CACHE) {
if($client->exists($request_uri)) {
return unserialize($client->get($request_uri));
}
}
// if(!$BYPASS_CACHE) {
// if($client->exists($request_uri)) {
// return unserialize($client->get($request_uri));
// }
// }
$categories = sanitize_textarea_field($_REQUEST['categories']);
$segment = trim(sanitize_textarea_field($_REQUEST['segment']));
......@@ -57,21 +57,22 @@ function pull_posts_for_post_list( $data ) {
$article_author = get_field('article_author', $post->ID) ?: null;
$author_title = get_field('author_title', $post->ID) ?: null;
$author_company = get_field('author_company', $post->ID) ?: null;
$img_id = get_post_thumbnail_id( $post->ID);
$alt = get_post($img_id)->post_excerpt;
$img = get_the_post_thumbnail_url($post, 'medium');
error_log('$alt');
error_log($alt);
if(!$img) {
$img = get_post_meta($post->ID, 'photo_from_source', true);
}
$new_posts[] = ['date'=>date_i18n( ' F j, Y', get_post_timestamp($post->ID)),
$new_posts[] = ['date'=>en_fr_date( get_post_timestamp($post->ID)),
'article_author'=>$article_author,'author_title'=>$author_title,
'author_company'=>$author_company,'href'=>get_permalink($post),'title'=>$post->post_title,
'text'=>$excerpt,'img_src'=>$img];
'text'=>$excerpt,'img_src'=>$img,'img_alt'=>$alt];
}
$client->set($request_uri, serialize(['posts'=>$new_posts,'last_index'=>0]), 'ex', 3600);
//$client->set($request_uri, serialize(['posts'=>$new_posts,'last_index'=>0]), 'ex', 3600);
return ['posts'=>$new_posts,'last_index'=>0];
......@@ -115,16 +116,21 @@ function pull_posts_for_post_list( $data ) {
$article_author = get_field('article_author', $post->ID) ?: null;
$author_title = get_field('author_title', $post->ID) ?: null;
$author_company = get_field('author_company', $post->ID) ?: null;
$img_id = get_post_thumbnail_id( $post->ID);
$alt = get_post($img_id)->post_excerpt;
error_log('$alt');
error_log($alt);
$img = get_the_post_thumbnail_url($post, 'medium_large');
if(!$img) {
$img = get_post_meta($post->ID, 'photo_from_source', true);
}
$posts[] = ['date'=>date_i18n( ' F j, Y', get_post_timestamp($post->ID)),
$posts[] = ['date'=>en_fr_date( get_post_timestamp($post->ID)),
'article_author'=>$article_author,'author_title'=>$author_title,
'author_company'=>$author_company,'href'=>get_permalink($post),'title'=>$post->post_title,
'text'=>$excerpt,'img_src'=>$img];
'text'=>$excerpt,'img_src'=>$img,'img_alt'=>$alt];
}
......@@ -133,7 +139,7 @@ function pull_posts_for_post_list( $data ) {
$last_index = true;
}
$client->set($request_uri, serialize(['posts'=>$posts,'last_index'=>$last_index]), 'ex', 3600);
//$client->set($request_uri, serialize(['posts'=>$posts,'last_index'=>$last_index]), 'ex', 3600);
return ['posts'=>$posts,'last_index'=>$last_index];
......
......@@ -17,7 +17,7 @@ add_action( 'init' , 'wptp_add_tags_to_attachments' );
add_action('init','set_exclude_from_search');
//add_action('init','set_exclude_from_search');
function set_exclude_from_search()
{
if ($_GET['var'] =='set_wpml_from_search') {
......@@ -41,7 +41,7 @@ function set_exclude_from_search()
}
}
add_action('init','delete_exclude_from_search');
//add_action('init','delete_exclude_from_search');
function delete_exclude_from_search()
{
if ($_GET['var'] =='delete_wpml_from_search') {
......@@ -58,7 +58,7 @@ function delete_exclude_from_search()
}
add_action('init','update_tax_counts');
//add_action('init','update_tax_counts');
function update_tax_counts()
{
if ($_GET['var'] =='update_tax_counts') {
......
......@@ -20670,7 +20670,7 @@
if (size == 2) {
li += "<li class='article-card lg'><a href='" + post_obj['href'] + "'>";
if (post_obj['img_src']) {
li += "<div class='image large'><div class='scale-wrapper'><img width='500' height='340' src='" + post_obj['img_src'] + "' /></div></div>";
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>";
}
if (post_obj['title'].length > 100) {
li += "<div class='content reduce'><span class='news-title'>" + post_obj['title'] + "</span></div>";
......@@ -20687,7 +20687,7 @@
} else {
li += "<li class='article-card sm'><a href='" + post_obj['href'] + "'>";
if (post_obj['img_src']) {
li += "<div class='image'><div class='scale-wrapper'><img width='215' height='140' src='" + post_obj['img_src'] + "' /></div></div>";
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>";
}
if (post_obj['title'].length > 100) {
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 @@
// Exit if accessed directly.
defined( 'ABSPATH' ) || exit;
$imgid = get_post_thumbnail_id($search_posts[$i]['ID']);
$img = "";
$img ="";
$imgid = get_post_thumbnail_id();
$post_type = get_post_type(get_the_ID());
$permalink = get_permalink();
$target = '';
......@@ -78,7 +76,7 @@ if ( !empty( $terms ) && !is_wp_error( $terms ) ){
</header><!-- .entry-header -->
<div class="entry-summary" id='content'>
<div class="entry-summary" >
<?= str_replace("[...]Read More...", "",wp_strip_all_tags($excerpt, true)); ?>
......
......@@ -50,10 +50,6 @@ if ($thumbnail_image && isset($thumbnail_image[0])) {
<div class="breadcrumb"><?php get_breadcrumb(); ?></div>
<?php the_field('header_text'); ?>
</div>
<?php if($badge){
$badge_content = get_field('badge_content');
echo "<div class='badge'><span>".$badge_content['badge_label']."</span><div class='badge_content'><p>".$badge_content['badge_text']."</p></div></div>";
}?>
</div>
</div>
......
......@@ -9,7 +9,10 @@
defined( 'ABSPATH' ) || exit;
get_header();
$search='';
if(isset($_GET["_sf_s"])){
$search = $_GET["_sf_s"];
}
?>
<div class="wrapper" id="search-wrapper">
......@@ -19,7 +22,8 @@ get_header();
<?php //get_search_form() ?>
<div class="top-search">
<li class="sf-field-search"><label>
<input placeholder="<?php _e('Search …','msf');?>" id="top-search" class="sf-input-text" type="text" value="<?php echo $_GET["_sf_s"]; ?>" title=""></label></li>
<span class="screen-reader-text">Search</span>
<input placeholder="<?php _e('Search …','msf');?>" id="top-search" class="sf-input-text" type="text" value="<?php echo $search; ?>" title=""></label></li>
<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>
</div>
<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])) {
$photo_caption = $thumbnail_image[0]->post_excerpt;
$img_alt = get_post_meta($post_thumbnail_id , '_wp_attachment_image_alt', true);
$img_title = $thumbnail_image[0]->post_title;
$copy = $thumbnail_image[0]->post_title;
$copy = get_field('copy', $post_thumbnail_id );
if(!$copy){
$en_post_thumbnail_id = apply_filters( 'wpml_object_id', $post_thumbnail_id , 'attachment', FALSE, 'en' );
$copy = get_field('copy', $en_post_thumbnail_id );
}
}
......
......@@ -7,7 +7,7 @@ function postItem(post_obj, size, sides, side_index, side_alternate, labels) {
if(size == 2) {
li += "<li class='article-card lg'><a href='"+post_obj['href']+"'>";
if(post_obj['img_src']) {
li += "<div class='image large'><div class='scale-wrapper'><img width='500' height='340' src='"+post_obj['img_src']+"' /></div></div>";
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>";
}
if(post_obj['title'].length > 100) {
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) {
} else {
li += "<li class='article-card sm'><a href='"+post_obj['href']+"'>";
if(post_obj['img_src']) {
li += "<div class='image'><div class='scale-wrapper'><img width='215' height='140' src='"+post_obj['img_src']+"' /></div></div>";
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>";
}
if(post_obj['title'].length > 100) {
li += "<div class='content reduce'><span class='news-title'>"+post_obj['title']+"</span>";
......
......@@ -2,6 +2,8 @@
body {
font-family: "PT Sans",sans-serif;
overflow-y: scroll !important;
padding-right: 0px !important;
}
......
......@@ -2,5 +2,5 @@
Theme Name: MSF CA Child
Author: Tenzing Communications
Template: msf-ca
Version: 1.0.60
Version: 1.0.61
*/
\ No newline at end of file
......