From bf7ffa37be106a4ed70836b32bfc5b79301d700d Mon Sep 17 00:00:00 2001 From: Denver Prophit Jr Date: Fri, 17 Nov 2017 07:15:07 -0500 Subject: [PATCH 1/6] Updates CPT post type to have featured image Updates issue /designwall/dw-question-answer/#213 which I believe will enable featured image ability when Question is edited and saved. I'm having to go backwards into my hacks. I believe I also modified a language define or two. --- inc/Posts/Question.php | 210 ++++++++++++++++++++++------------------- 1 file changed, 115 insertions(+), 95 deletions(-) diff --git a/inc/Posts/Question.php b/inc/Posts/Question.php index 12fc19dd..e582d65d 100644 --- a/inc/Posts/Question.php +++ b/inc/Posts/Question.php @@ -8,42 +8,42 @@ function dwqa_related_question( $question_id = false, $number = 5, $echo = true $question_id = get_the_ID(); } $tag_in = $cat_in = array(); - $tags = wp_get_post_terms( $question_id, 'dwqa-question_tag' ); - if ( ! empty($tags) ) { + $tags = wp_get_post_terms( $question_id, 'dwqa-question_tag' ); + if ( ! empty( $tags ) ) { foreach ( $tags as $tag ) { $tag_in[] = $tag->term_id; } } $category = wp_get_post_terms( $question_id, 'dwqa-question_category' ); - if ( ! empty($category) ) { + if ( ! empty( $category ) ) { foreach ( $category as $cat ) { $cat_in[] = $cat->term_id; } } $args = array( - 'orderby' => 'rand', - 'post__not_in' => array($question_id), - 'showposts' => $number, + 'orderby' => 'rand', + 'post__not_in' => array( $question_id ), + 'showposts' => $number, 'ignore_sticky_posts' => 1, - 'post_type' => 'dwqa-question', + 'post_type' => 'dwqa-question', ); $args['tax_query']['relation'] = 'OR'; if ( ! empty( $cat_in ) ) { $args['tax_query'][] = array( - 'taxonomy' => 'dwqa-question_category', - 'field' => 'id', - 'terms' => $cat_in, - 'operator' => 'IN', + 'taxonomy' => 'dwqa-question_category', + 'field' => 'id', + 'terms' => $cat_in, + 'operator' => 'IN', ); } if ( ! empty( $tag_in ) ) { $args['tax_query'][] = array( - 'taxonomy' => 'dwqa-question_tag', - 'field' => 'id', - 'terms' => $tag_in, - 'operator' => 'IN', + 'taxonomy' => 'dwqa-question_tag', + 'field' => 'id', + 'terms' => $tag_in, + 'operator' => 'IN', ); } @@ -52,8 +52,9 @@ function dwqa_related_question( $question_id = false, $number = 5, $echo = true if ( $related_questions->have_posts() ) { if ( $echo ) { echo '