Skip to content

Commit

Permalink
Better failsafes exist
Browse files Browse the repository at this point in the history
  • Loading branch information
Ipstenu committed Dec 15, 2023
1 parent 09c1363 commit d6e45e6
Show file tree
Hide file tree
Showing 4 changed files with 13 additions and 13 deletions.
2 changes: 2 additions & 0 deletions inc/widgets/character-widget.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,8 +74,10 @@ public function widget( $args, $instance ) {
echo '<h4 class="card-title">' . esc_html( get_the_title() ) . '</h4>';
echo '<div class="card-text">';
// Only show one show
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo lwtv_plugin()->get_character_data( get_the_ID(), 'oneshow' );
// Actor
// phpcs:ignore WordPress.Security.EscapeOutput.OutputNotEscaped
echo lwtv_plugin()->get_character_data( get_the_ID(), 'oneactor' );
echo '</div>
</div>';
Expand Down
4 changes: 1 addition & 3 deletions related-post-plugin/related-posts-lwtv-cards.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,12 @@
* Empty array if no related posts are found.
* @var array $rpbt_args Widget or shortcode arguments.
*/
?>

<?php
/**
* Note: global $post; is used before this template by the widget and the shortcode.
*/

if ( $related_posts ) {
if ( is_array( $related_posts ) && $related_posts ) {
?>
<div class="container related-posts-by-taxonomy-container">
<div class="row site-loop related-posts-by-taxonomy-loop">
Expand Down
15 changes: 8 additions & 7 deletions template-parts/content-post_type_actors.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,11 +239,10 @@
<section name="related-posts" id="related-posts" class="relatedposts-section">
<h2>Related Articles</h2>
<div class="card-body">
<?php
if ( method_exists( 'LWTV_CPTs_Related_Posts', 'related_posts' ) && method_exists( 'LWTV_CPTs_Related_Posts', 'count_related_posts' ) ) {
echo lwtv_plugin()->get_cpt_related_posts( $slug ); // phpcs:ignore WordPress.Security.EscapeOutput
}
?>
<?php
// phpcs:ignore WordPress.Security.EscapeOutput
echo lwtv_plugin()->get_cpt_related_posts( $slug );
?>
</div>
</section>
<?php
Expand All @@ -267,8 +266,10 @@
echo wp_kses_post( '<p>There ' . sprintf( _n( 'is <strong>%s</strong> character', 'are <strong>%s</strong> characters', $havecharcount ), $havecharcount ) . ' listed for this actor; ' . $deadtext . '.</p>' );

echo '<div class="container characters-regulars-container"><div class="row site-loop character-show-loop">';
foreach ( $all_chars as $character ) {
include locate_template( 'template-parts/excerpt-post_type_characters.php' );
if ( is_array( $all_chars ) ) {
foreach ( $all_chars as $character ) {
include locate_template( 'template-parts/excerpt-post_type_characters.php' );
}
}
echo '</div></div>';
}
Expand Down
5 changes: 2 additions & 3 deletions template-parts/content-post_type_shows.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,9 +128,8 @@
<h2>Articles</h2>
<div class="container"><div class="card-body">
<?php
if ( method_exists( 'LWTV_CPTs_Related_Posts', 'related_posts' ) && method_exists( 'LWTV_CPTs_Related_Posts', 'count_related_posts' ) ) {
echo lwtv_plugin()->get_cpt_related_posts( $slug ); // phpcs:ignore WordPress.Security.EscapeOutput
}
// phpcs:ignore WordPress.Security.EscapeOutput
echo lwtv_plugin()->get_cpt_related_posts( $slug );
?>
</div></div>
</section>
Expand Down

0 comments on commit d6e45e6

Please sign in to comment.