Show excerpt on category level
-
By default, the show_excerpt option only applies to the FAQ homepage. On a category level, full FAQ’s are shown.
This can be altered by applying a small change to shortcode.php.
First, find the section on category} elseif ( $catname || $cat ) { // Show a single category //
Just after the comment link creation,
put in the following code:
$qafp_shortcode_output .= '<div id="qafp-faq' . $post->ID . '" class="qafp-faq"' . $faqmargin . '> <div class="qafp-faq-title" style="' . $qafp_options['titlecss'] . '"><a class="qafp-faq-anchor" href="' . get_permalink() . '">'; if ( $showplusminus === true ) { $qafp_shortcode_output .= '<span class="qafp-fa-caret-right"></span>'; } $qafp_shortcode_output .= get_the_title() . '</a></div> <div class="qafp-faq-answer"' . $answermargin . '>' ; if ( $excerpts === true ) { $qafp_shortcode_output .= apply_filters( 'the_excerpt', get_the_excerpt() ); } else { $qafp_shortcode_output .= apply_filters( 'the_content', get_the_content() ); } // Start permalinks and ratings code
so replacing the section beween
$qafp_shortcode_output .= '<div id="qafp-faq' . $post->ID . '" class="qafp-faq"' . $faqmargin . '>
and
// Start permalinks and ratings code
Also notice that I have the excerpt apply the correct filters for an excerpt. by using
apply_filters( 'the_excerpt'
instead ofapply_filters( 'the_content'
Can you confirm if my change is valid?
- The topic ‘Show excerpt on category level’ is closed to new replies.