Making WordPress.org


Ignore:
Timestamp:
06/17/2016 08:27:41 PM (8 years ago)
Author:
obenland
Message:

Plugin Directory: Introduce a reviews shortcode.

Displays a list of reviews about a plugin.
WIP, still need to properly grab an entire review, not just the rating.

See #1719.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-plugins/template-parts/plugin-single.php

    r3412 r3420  
    4545        <?php
    4646            $plugin_sections = Template::get_plugin_sections();
     47
    4748            foreach ( array( 'description', 'screenshots', 'faq', 'reviews', 'changelog', 'developers' ) as $section_slug ) :
    48                 if ( ! array_key_exists( $section_slug, $content ) || in_array( $section_slug, array( 'installation', 'other_notes' ) ) ) :
     49                $section_content = trim( apply_filters( 'the_content', $content[ $section_slug ], $section_slug ) );
     50
     51                if ( ! array_key_exists( $section_slug, $content ) || in_array( $section_slug, array( 'installation', 'other_notes' ) ) || empty( $section_content ) ) :
    4952                    continue;
    5053                endif;
     54
    5155                $section = wp_list_filter( $plugin_sections, array( 'slug' => $section_slug ) );
    5256                $section = array_pop( $section );
     
    5559            <div id="<?php echo esc_attr( $section_slug ); ?>" class="read-more" aria-expanded="false">
    5660                <h2><?php echo $section['title']; ?></h2>
    57                 <?php echo apply_filters( 'the_content', $content[ $section_slug ], $section_slug ); ?>
     61                <?php echo $section_content; ?>
    5862            </div>
    5963            <button type="button" class="button-link section-toggle" aria-controls="<?php echo esc_attr( $section_slug ); ?>"><?php _e( 'Read more', 'wporg-plugins' ); ?></button>
Note: See TracChangeset for help on using the changeset viewer.