From 5ea24044bf53db270cbe41305d5b26c9e6c1e7ea Mon Sep 17 00:00:00 2001 From: Stefan Bohacek Date: Sun, 12 Mar 2023 17:05:48 -0400 Subject: [PATCH] Show resource pages if description is present, otherwise redirect to them. --- includes/shortcodes/post-links.php | 41 +++++++++++++----------------- 1 file changed, 17 insertions(+), 24 deletions(-) diff --git a/includes/shortcodes/post-links.php b/includes/shortcodes/post-links.php index 1afe934..86ccfe7 100644 --- a/includes/shortcodes/post-links.php +++ b/includes/shortcodes/post-links.php @@ -16,13 +16,11 @@ public function post_link_shortcode( $atts ) { if ( get_post_status( $post_id ) === 'publish' ){ $link_classes = $atts['class']; - $link_url = get_post_meta( $post_id, 'resource_url', true ); - - if ( empty( $link_url ) ){ - $link_url = post_permalink( $post_id ); - } - else{ + if (empty(get_the_content($post_id))){ $is_external = true; + $link_url = get_post_meta( $post_id, 'resource_url', true ); + } else { + $link_url = post_permalink( $post_id ); } $link_title = get_the_title( $post_id ); @@ -50,13 +48,12 @@ public function btn_list_shortcode( $atts ) { $link_list_html = '