Skip to content

Commit

Permalink
Merge pull request #2193 from CityOfPhiladelphia/removals
Browse files Browse the repository at this point in the history
Removals
  • Loading branch information
m-atia authored Oct 8, 2024
2 parents 24141f4 + 55943db commit 07ed610
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 68 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,15 @@
/*
* Featured content block
*
* TODO: Remove fallback for old news_post content type
*/
?>

<?php $main_feature_args = array(
'posts_per_page' => 1,
'post_type' => array('post', 'news_post'),
'post_type' => array('post'),
'order' => 'desc',
'orderby' => 'date',
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'phila_show_on_home',
'value' => '1',
'compare' => '=',
),
array(
'meta_query' => array(
'relation' => 'AND',
array(
'key' => 'phila_is_feature',
Expand All @@ -29,7 +21,6 @@
'key' => '_thumbnail_id',
'compare' => 'EXISTS'
),
),
),
'ignore_sticky_posts' => 1, // We have to ignore sticky, otherwise we might show more than one post
); ?>
Expand Down Expand Up @@ -60,18 +51,12 @@

<?php $feature_args = array(
'posts_per_page' => 3,
'post_type' => array('post', 'news_post'),
'post_type' => array('post'),
'order' => 'desc',
'orderby' => 'date',
'post__not_in' => array( $main_feature_id ),
'ignore_sticky_posts' => 1,
'meta_query' => array(
'relation' => 'OR',
array(
'key' => 'phila_show_on_home',
'value' => '1',
'compare' => '=',
),
array(
'key' => 'phila_is_feature',
'value' => '1',
Expand Down
29 changes: 15 additions & 14 deletions wp/wp-content/themes/phila.gov-theme/partials/posts/post-grid.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,27 +4,32 @@
*
*/
?>
<?php
<?php
$override = rwmb_meta('phila_get_post_cats');
$override_url = isset($override['override_url']) ? $override['override_url'] : '';
$post_categories = isset($category) ? $category : '';
$override_url = isset($override['override_url']) ? $override['override_url'] : '';
$is_tag = isset($is_spotlight_tag) ? $is_spotlight_tag : rwmb_meta('phila_get_post_cats');
$tag = isset($is_tag['tag']) ? $is_tag['tag'] : $a['tag'];

if (!is_page_template('templates/the-latest.php') ) {
$is_tag = isset($is_spotlight_tag) ? $is_spotlight_tag : rwmb_meta('phila_get_post_cats');
$tag = isset($is_tag['tag']) ? $is_tag['tag'] : $a['tag'];

}

?>
<?php if (!empty($post_categories)): ?>
<?php foreach ($post_categories as $category ) {
$current_cat = get_category($category);
$slang_name = urlencode(html_entity_decode(trim( phila_get_owner_typography( $current_cat ))));
} ?>
<?php else: ?>
<?php
<?php
$current_cat = null;
$slang_name = '';
?>
<?php endif; ?>
<?php

<?php

/* if categories aren't set, this is the latest. */
if ( empty( $post_categories ) ) {
Expand Down Expand Up @@ -52,7 +57,7 @@
$sticky_posts = new WP_Query( $sticky_args );
set_transient( get_the_ID().'_sticky_posts_results', $sticky_posts, 1 * HOUR_IN_SECONDS );
}


}

Expand Down Expand Up @@ -111,10 +116,6 @@
'value' => 'english',
'compare' => '=',
),
array(
'key' => 'phila_select_language',
'compare' => 'NOT EXISTS'
),
),
)
);
Expand All @@ -129,10 +130,10 @@
set_transient( get_the_ID().'_empty_posts_results', $result, 1 * HOUR_IN_SECONDS );
}


//if sticky posts is empty, don't add it to the results array
$result->posts = array_merge(isset($sticky_posts->posts) ? $sticky_posts->posts : array(), $more_posts->posts);

}
$result->post_count = count( $result->posts );

Expand Down Expand Up @@ -208,7 +209,7 @@
$see_all_URL = array(
'URL' => '/the-latest/archives/?tag=' . $term,
);
else:
else:
$term = get_term($tag, 'post_tag');
$see_all_URL = array(
'URL' => '/the-latest/archives/?tag=' . $term->name,
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
<?php
//Don't execute this code if we're on the latest
if (is_page_template('templates/the-latest.php') ):
if (is_page_template('templates/the-latest.php') ):
return;
endif;
if (isset( $tag )) {
Expand All @@ -25,11 +25,6 @@
'value' => 'english',
'compare' => '!=',
),
array(
'key' => 'phila_select_language',
'value' => '',
'compare' => '!=',
),
),
)
);
Expand All @@ -54,11 +49,6 @@
'value' => 'english',
'compare' => '!=',
),
array(
'key' => 'phila_select_language',
'value' => '',
'compare' => '!=',
),
),
)
);
Expand All @@ -67,11 +57,11 @@
$is_translated = new WP_Query( $translations );
$langs = array();

while ( $is_translated->have_posts() ) : $is_translated->the_post();
while ( $is_translated->have_posts() ) : $is_translated->the_post();
$lang = rwmb_meta('phila_select_language', '', $post->ID);
$langs[$lang] = $lang;
endwhile;

$unique_langs = phila_order_languages(array_unique($langs));

if (!empty($tag)) {
Expand All @@ -90,7 +80,7 @@
<h2 id="posts">Posts</h2>
<ul class="translated-list">
<?php foreach ($unique_langs as $lang): ?>
<?php if ($lang === 'english') :
<?php if ($lang === 'english') :
$url = '/the-latest/archives/?templates=post&language=english';
if (!empty($term)) {
$url .= '&tag=' . $term->name;
Expand All @@ -102,7 +92,7 @@
?>
<li><a href="<?php echo $url; ?>">English</a></li>
<?php endif; ?>
<?php if ($lang === 'spanish') :
<?php if ($lang === 'spanish') :
$url = '/the-latest/archives/?templates=post&language=spanish';
if (!empty($term)) {
$url .= '&tag=' . $term->name;
Expand All @@ -114,7 +104,7 @@
?>
<li><a href="<?php echo $url; ?>">Español</a></li>
<?php endif; ?>
<?php if ($lang === 'chinese') :
<?php if ($lang === 'chinese') :
$url = '/the-latest/archives/?templates=post&language=chinese';
if (!empty($term)) {
$url .= '&tag=' . $term->name;
Expand All @@ -126,7 +116,7 @@
?>
<li><a href="<?php echo $url; ?>">中文</a></li>
<?php endif; ?>
<?php if ($lang === 'vietnamese') :
<?php if ($lang === 'vietnamese') :
$url = '/the-latest/archives/?templates=post&language=vietnamese';
if (!empty($term)) {
$url .= '&tag=' . $term->name;
Expand All @@ -137,7 +127,7 @@
}?>
<li><a href="<?php echo $url ?>">Tiếng Việt</a></li>
<?php endif; ?>
<?php if ($lang === 'russian') :
<?php if ($lang === 'russian') :
$url = '/the-latest/archives/?templates=post&language=russian';
if (!empty($term)) {
$url .= '&tag=' . $term->name;
Expand All @@ -148,7 +138,7 @@
}?>
<li><a href="<?php echo $url ?>">Pусский</a></li>
<?php endif; ?>
<?php if ($lang === 'french') :
<?php if ($lang === 'french') :
$url = '/the-latest/archives/?templates=post&language=french';
if (!empty($term)) {
$url .= '&tag=' . $term->name;
Expand All @@ -164,5 +154,5 @@
</div>
<?php else: ?>
<h2 id="posts">Posts</h2>
<?php endif; ?>
<?php endif; ?>
<?php wp_reset_postdata();?>
15 changes: 0 additions & 15 deletions wp/wp-content/themes/phila.gov-theme/templates/the-latest.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,12 +36,6 @@
<div>Posts</div>
</a>
</li>
<li class="action_guide cell medium-auto small-24">
<a href="#action-guides">
<i class="fas fa-users fa-fw fa-3x" aria-hidden="true"></i>
<div>Action guides</div>
</a>
</li>
<li class="event cell medium-auto small-24">
<a href="#events">
<i class="far fa-calendar-check fa-fw fa-3x" aria-hidden="true"></i>
Expand Down Expand Up @@ -99,15 +93,6 @@
</div>
</section>

<section>
<div id="action-guides" data-magellan-target="action-guides">
<header class="row columns mtl">
<h1>Action guides</h1>
</header>
<?php get_template_part('partials/posts/action-guide', 'grid'); ?>
</div>
</section>

<section>
<div id="events" data-magellan-target="events">
<header class="row columns mtl">
Expand Down

0 comments on commit 07ed610

Please sign in to comment.