Making WordPress.org


Ignore:
Timestamp:
09/11/2020 12:29:47 AM (4 years ago)
Author:
dufresnesteven
Message:

Support: Add function to get review title.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-support/functions.php

    r10096 r10247  
    337337
    338338    return ( WordPressdotorg\Forums\Plugin::REVIEWS_FORUM_ID == bbp_get_topic_forum_id() );
     339}
     340
     341/**
     342 * Get post title for single review
     343 *
     344 * @return string|bool Returns post title if it exists. Otherwise returns false.
     345 */
     346function wporg_support_get_single_review_title() {
     347    if ( ! class_exists( 'WordPressdotorg\Forums\Plugin' ) || ! bbp_is_single_topic() ) {
     348        return false;
     349    }
     350
     351    $plugin_instance = WordPressdotorg\Forums\Plugin::get_instance();
     352    $review = $plugin_instance->plugins->plugin ?? $plugin_instance->themes->theme;
     353
     354    return isset( $review ) ? $review->post_title : false;
    339355}
    340356
Note: See TracChangeset for help on using the changeset viewer.