WordPress.org

Forums

Travelify
[resolved] Travelify and bbPress (4 posts)

  1. gabbuz
    Member
    Posted 1 year ago #

    Hello :)

    I needed a way to make Travelify compatible with bbPress forum for my website and I found a solution (as it is, the forum is showed as a blog post with the sidebars).

    Hope you can check my "work" and apply it to the official version :D

    Added forum.php in the theme root:

    <?php
    /**
     * Template Name: Forum Full Content Display
     *
     * Displays the Forum with Full Content Display.
     *
     */
    ?>
    
    <?php get_header(); ?>
    
    <?php
    	/**
    	 * travelify_before_main_container hook
    	 */
    	do_action( 'travelify_before_main_container' );
    ?>
    
    <div id="container">
    	<?php
    		/**
    		 * travelify_main_container hook
    		 *
    		 * HOOKED_FUNCTION_NAME PRIORITY
    		 *
    		 * travelify_content 10
    		 */
    		do_action( 'travelify_forum_container' );
    	?>
    </div><!-- #container -->
    
    <?php
    	/**
    	 * travelify_after_main_container hook
    	 */
    	do_action( 'travelify_after_main_container' );
    ?>
    
    <?php get_footer(); ?>

    Some dits in content-extensions.php:

    add_action( 'travelify_loop_content', 'travelify_theloop', 10 );
    /**
     * Shows the loop content
     */
    function travelify_theloop() {
    	if( is_page() ) {
    		if( is_page_template( 'templates/template-blog-large-image.php' ) ) {
    			travelify_theloop_for_template_blog_image_large();
    		}
    		elseif( is_page_template( 'templates/template-blog-medium-image.php' ) ) {
    			travelify_theloop_for_template_blog_image_medium();
    		}
    		elseif( is_page_template( 'templates/template-blog-full-content.php' ) ) {
    			travelify_theloop_for_template_blog_full_content();
    		}
    		else {
    			travelify_theloop_for_page();
    		}
    	}
    	elseif( is_single() || is_bbpress()) {
    		travelify_theloop_for_single();
    	}
    	elseif( is_search() ) {
    		travelify_theloop_for_search();
    	}
    	else {
    		travelify_theloop_for_archive();
    	}
    }

    and

    if ( ! function_exists( 'travelify_theloop_for_single' ) ) :
    /**
     * Fuction to show the single post content.
     */
    function travelify_theloop_for_single() {
    	global $post;
    
    	if( have_posts() ) {
    		while( have_posts() ) {
    			the_post();
    
    			do_action( 'travelify_before_post' );
    ?>
    	<section id="post-<?php the_ID(); ?>" <?php post_class(); ?>>
    		<article>
    
    			<?php do_action( 'travelify_before_post_header' ); ?>
    
    			<header class="entry-header">
        			<h2 class="entry-title">
        				<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute();?>"><?php the_title(); ?></a>
        			</h2><!-- .entry-title -->
      			</header>
    
      			<?php do_action( 'travelify_after_post_header' ); ?>
    
      			<?php do_action( 'travelify_before_post_content' ); 
    
                            if(!is_bbpress()){?>
    
      			<div class="entry-meta-bar clearfix">
        			<div class="entry-meta">
    	    				<span class="author"><a href="<?php echo get_author_posts_url( get_the_author_meta( 'ID' ) ); ?>"><?php the_author(); ?></a></span>
    	    				<span class="date"><a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( get_the_time() ); ?>"><?php the_time( get_option( 'date_format' ) ); ?></a></span>
    	    				<?php if( has_category() ) { ?>
    	             		<span class="category"><?php the_category(', '); ?></span>
    	             	<?php } ?>
    	    				<?php if ( comments_open() ) { ?>
    	             		<span class="comments"><?php comments_popup_link( __( 'No Comments', 'travelify' ), __( '1 Comment', 'travelify' ), __( '% Comments', 'travelify' ), '', __( 'Comments Off', 'travelify' ) ); ?></span>
    	             	<?php } ?>
        			</div><!-- .entry-meta -->
                            </div>
                            <?php } /* end of forum edits */>
      			<div class="entry-content clearfix">
        			<?php the_content();
        			if( is_single() ) {
    						$tag_list = get_the_tag_list( '', __( ', ', 'travelify' ) );
    
    						if( !empty( $tag_list ) ) {
    							?>
    							<div class="tags">
    								<?php echo $tag_list; ?>
    							</div>
    							<?php
    						}
    					}
    
                   wp_link_pages( array(
    						'before'            => '<div style="clear: both;"></div><div class="pagination clearfix">'.__( 'Pages:', 'travelify' ),
    						'after'             => '</div>',
    						'link_before'       => '<span>',
    						'link_after'        => '</span>',
    						'pagelink'          => '%',
    						'echo'              => 1
                   ) );
                   ?>
      			</div>
    
      			<?php 
    
      			do_action( 'travelify_after_post_content' );
    
      			do_action( 'travelify_before_comments_template' ); 
    
             comments_template(); 
    
             do_action ( 'travelify_after_comments_template' );
    
             ?>
    
    		</article>
    	</section>
    <?php
    			do_action( 'travelify_after_post' );
    
    		}
    	}
    	else {
    		?>
    		<h1 class="entry-title"><?php _e( 'No Posts Found.', 'travelify' ); ?></h1>
          <?php
       }
    }
    endif;

    Let me know if you can apply these edits in the official version or if here is an easier way to do so.

  2. Submitting patches via the support forum usually doesn't get you very far. Have you considered using the contact link on the theme author's page instead?

  3. Silkalns
    Member
    Theme Author

    Posted 1 year ago #

    Thank you for your outstanding contribution!

    Will include this into next theme version as there were some few people already requesting this feature.

    Thank you! Really appreciate it!

  4. gabbuz
    Member
    Posted 1 year ago #

    Great to hear it, hope to see that update soon :)

Topic Closed

This topic has been closed to new replies.

About this Theme

About this Topic