bbp_post_actions(); $this->theme_support(); $this->post_type_support(); } /** * Loads all the parent theme files * * @since 1.0.0 */ public function launch() { # Hook in before the action happens do_action( 'bizznis_pre_bbpress_integration' ); # Stop here, if bizznis bbpress integratin is not defined if ( ! current_theme_supports( 'bizznis-bbpress' ) ) { return; } } /** * Tweak Bizznis post actions * * @since 1.0.0 */ public function bbp_post_actions() { # Manipulate with bizznis hooks add_action( 'wp_head', array( $this, 'bizznis_post_actions' ) ); add_action( 'wp_head', array( $this, 'bbp_forum_layout' ) ); } /** * Check if bbPress template * * @since 1.0.2 */ public function bizznis_post_actions() { # Stop here, if not on a bbpress template if ( ! is_bbpress() ) { return; } # Remove bizznis breadcrumbs remove_action( 'bizznis_loop', 'bizznis_do_breadcrumbs', 4 ); # Remove post info & meta remove_action( 'bizznis_post_content', 'bizznis_post_info' ); remove_action( 'bizznis_post_content', 'bizznis_post_meta' ); remove_action( 'bizznis_entry_header', 'bizznis_post_info' ); remove_action( 'bizznis_entry_footer', 'bizznis_post_meta' ); # Remove Bizznis post image and content remove_action( 'bizznis_post_content', 'bizznis_do_post_image' ); remove_action( 'bizznis_post_content', 'bizznis_do_post_content' ); remove_action( 'bizznis_entry_content', 'bizznis_do_post_image' ); remove_action( 'bizznis_entry_content', 'bizznis_do_post_content' ); # Remove authorbox remove_action( 'bizznis_after_entry', 'bizznis_do_author_box_single' ); remove_action( 'bizznis_entry_footer', 'bizznis_do_author_box_single' ); # Remove the navigation remove_action( 'bizznis_after_endwhile', 'bizznis_posts_nav' ); # Remove Bizznis profile fields if ( bbp_is_single_user_edit() ) { remove_action( 'show_user_profile', 'bizznis_user_options_fields' ); remove_action( 'show_user_profile', 'bizznis_user_layout_fields' ); remove_action( 'show_user_profile', 'bizznis_user_seo_fields' ); remove_action( 'show_user_profile', 'bizznis_user_archive_fields' ); } # Re-add the_content back add_action( 'bizznis_post_content', 'the_content' ); add_action( 'bizznis_entry_content', 'the_content' ); } /** * Register forum specific layout if enabled * * @since 1.0.0 */ public function bbp_forum_layout() { # Stop here, if not on a bbpress template if ( ! is_bbpress() ) { return; } # Replace layout with custom selected inside theme settings add_filter( 'bizznis_pre_get_option_site_layout', array( $this, 'bbp_select_layout' ) ); } /** * Selecz forum specific sidebar if enabled * * @since 1.0.0 */ public function bbp_select_layout() { # For some reason, if we use the cached version, weird things seem to happen. $retval = bizznis_get_default_layout(); $parent = false; # Check and see if a layout has been set for the parent topic $topic_id = bbp_get_topic_id(); if ( ! empty( $topic_id ) ) { $parent = esc_attr( get_post_meta( $topic_id, '_bizznis_layout' , true ) ); if ( !empty( $parent ) ) { return apply_filters( 'bizznis_bbp_layout', $parent ); } } # Check and see if a layout has been set for the parent forum $forum_id = bbp_get_forum_id(); if ( ! empty( $forum_id ) ) { $parent = esc_attr( get_post_meta( $forum_id, '_bizznis_layout' , true ) ); if ( !empty( $parent ) ) { return apply_filters( 'bizznis_bbp_layout', $parent ); } } # Check if a layout has been defined in the bbPress Bizznis settings if ( empty( $parent ) || ( bizznis_get_option( 'bizznis_bbp_layout' ) !== 'bizznis-default' ) ) { $retval = bizznis_get_option( 'bizznis_bbp_layout' ); } # Filter the return value return apply_filters( 'bizznis_bbp_layout', $retval, $parent ); } /** * Activates default theme features. * * @since 1.0.0 */ public function theme_support() { add_theme_support( 'bbpress' ); add_theme_support( 'bizznis-bbpress' ); } /** * Initialize post type support for Bizznis features (Layout selector, SEO, Scripts). * * @since 1.0.0 */ public function post_type_support() { add_post_type_support( 'forum', array( 'bizznis-scripts', 'bizznis-layouts' ) ); add_post_type_support( 'topic', array( 'bizznis-scripts', 'bizznis-layouts' ) ); } } /** * Launch the ingration class * * @since 1.0.0 */ add_action( 'bbp_after_setup_theme', 'bizznis_bbp_integration' ); function bizznis_bbp_integration() { $bizznis = new Bizznis_BBP; #ready, set, go! $bizznis->launch(); }