can_use_premium_code() ) { return true; } } /** * BBP Core Admin pages * If any of the admin pages match the current page, return true. * * @return bool|void */ function bbpc_admin_pages($admin) { $current_url = ! empty( $_GET['page'] ) ? admin_url( 'admin.php?page=' ) . sanitize_text_field( wp_unslash( $_GET['page'] ) ) : ''; if ( $admin == 'admin' ){ if ( $current_url == admin_url('admin.php?page=bbp-core') ) { return true; } } elseif ( $admin == 'settings' ) { if ( $current_url == admin_url('admin.php?page=bbp-core-settings') ) { return true; } } } function bbpc_forum_assets(){ if ( bbp_is_single_forum() || bbp_is_single_topic() ) { return true; } } /** * Posts Arraty * @param object Post Type */ function bbp_core_get_posts( $post_type = 'forum' ) { $posts = get_pages( [ 'post_type' => $post_type, 'parent' => 0, ] ); $posts_array = []; if ( $posts ) { foreach ( $posts as $post ) { $posts_array[ $post->ID ] = $post->post_title; } } return $posts_array; } /** * Limit letter * @param $string * @param $limit_length * @param string $suffix */ function bbp_core_limit_letter( $string, $limit_length, $suffix = '...' ) { if ( strlen( $string ) > $limit_length ) { echo strip_shortcodes( substr( $string, 0, $limit_length ) . $suffix ); } else { echo strip_shortcodes( esc_html( $string ) ); } } /** * Return the topic view count. * * @param int $topic_id Optional. Topic id * * @return int The view count * @uses get_post_meta() To get the view count meta * @uses bbp_get_topic_id() To get the topic id */ function bbp_get_topic_view_count( $topic_id = 0 ) { $topic_id = bbp_get_topic_id( $topic_id ); if ( empty( $topic_id ) ) { return 0; } $views = (int) get_post_meta( $topic_id, '_btv_view_count', true ); return $views; } /** * Output the topic view count. * * @param int $topic_id Optional. Topic id * * @uses bbp_get_topic_id() To get the topic id * @uses btv_get_topic_view_count() To get the view count for the topic */ function bbp_topic_view_count( $topic_id = 0 ) { $topic_id = bbp_get_topic_id( $topic_id ); $view_count = bbp_get_topic_view_count( $topic_id ); return $view_count; } /** * Get forum title * @return string */ function bbpc_forum_title(){ $forum_id = bbp_get_forum_id(); $forum_title = get_the_title( $forum_id ); return $forum_title; } /** * Customizer section hide from customizer */ add_action( 'customize_register', function( $wp_customize ) { // Unset the section you want to hide $wp_customize->remove_section( 'design_fields' ); }, 20 );