Skip to:
Content
Pages
Categories
Search
Top
Bottom

Some startup help in designing my own theme?


  • tkse
    Participant

    @tkse

    Hi!

    This is how I’m looking to structure my /forums page. Any tips? Can I create my own front page/template file, or would I have to edit content-archive-forum.php?

    I notice it’s pretty much exactly like an individual forum/category page, though I want this on the home page, with all categories. The default front page (content-archive-forum.php) doesn’t give enough info about the forums as it is, and is just too compact and small.

Viewing 14 replies - 1 through 14 (of 14 total)

  • Robkk
    Moderator

    @robkk

    Download this file and edit it to change the word Freshness. Make sure to copy the file in a folder called bbpress in your child theme.

    https://github.com/robkk/bbPress-Hierarchical-Forum-and-Category-Layout

    Or try this that might help get the “by” and category layout. You should be able to copy all the folders in your child theme.

    https://github.com/EpicWebs/bbPress-starter-theme-epicwebs


    tkse
    Participant

    @tkse

    I tested the starter theme you linked and that is brilliant. There seems to be a lot of CSS to delve into, but that’s ok. Thanks! ๐Ÿ™‚


    Robkk
    Moderator

    @robkk

    Yeah Lynqs starter theme will get you most of the way there. And no problem! ๐Ÿ™‚


    tkse
    Participant

    @tkse

    I’ve been doing some testing tonight, and actually made the realization that the starter theme is not the way to go for me. The first suggestion of yours seem to give me what I’m after just as well, and with a lot less effort on my part in the next stages.

    In response to my other questions though (referencing this: https://bbpress.org/forums/topic/bbp-single-forum-wont-work/#post-166535):

    Surely, there’s got to be a way of displaying both the forum index AND other shortcode elements on the home page of the forum? Since it won’t allow me to do changes in wp-admin if I set a custom page as root, do I have to call the shortcode via PHP in my bbpress.php custom template file?

    Also, I’d love the front page “Latest update” to permalink the latest post, not the topic. Difficult task?


    Robkk
    Moderator

    @robkk

    Yeah you can insert a shortcode on the forum index page using some hooks that bbPress provides.

    bbp_template_after_forums_loop

    Here is a code snippet that will do what you are looking for though.

    Layout and functionality – Examples you can use

    For the freshness link it should link to whatever was the last activity, with that either being a reply or a topic created. If you want you can filter the forum freshness link to just show topics I guess. The filter is bbp_get_forum_freshness_link


    tkse
    Participant

    @tkse

    Thanks again! ๐Ÿ™‚


    tkse
    Participant

    @tkse

    Here is a code snippet that will do what you are looking for though.

    https://codex.bbpress.org/layout-and-functionality-examples-you-can-use/#21-show-5-recent-topics-after-forum-index

    This gives me the 5 most recent topics in single-forum as well, not just the forum index/home page of the forum. I tried working around it, and also directly solve the problem but with no luck.


    Robkk
    Moderator

    @robkk

    Hmm maybe I accidently placed the wrong hook?? Well I just fixed it on the page. Try it again ๐Ÿ™‚


    tkse
    Participant

    @tkse

    This works nicely. Sorry to bug you so much.

    The custom profile fields, what exactly do they do? I get that I can now add my Twitter handle from profile settings, but it’s not displayed anywhere on the site. I would love for it to be displayed beneath my avatar and username phpBB-style in topics, or at least on my visible forum profile. This doable? Obviously I can’t use the_author_meta() in bbpress, so…

    Also, instead of adding labels to certain topics. Can I add classes so I can do changes in CSS?

    Thanks! ๐Ÿ™‚


    Robkk
    Moderator

    @robkk

    The custom profile fields, what exactly do they do? I get that I can now add my Twitter handle from profile settings, but itโ€™s not displayed anywhere on the site.

    Yeah you have to manually place the any extra fields you want on the frontend of the user profile and and place the code in the template user-profile.php, that should be in your child theme for easy customization.

    in user-profile.php you will already see an example of the user’s description field being displayed, and you would need to do some of the same procedure.

    <?php if ( bbp_get_displayed_user_field( 'twitter' ) ) : ?>
    
        <p class="bbp-user-twitter">
            <a href="<?php bbp_displayed_user_field( 'twitter' ); ?>" title="<?php bbp_displayed_user_field( 'display_name' ); ?>'s Twitter" rel="nofollow">
                 <?php bbp_displayed_user_field( 'twitter' ); ?>
            </a>
        </p>
    
    <?php endif; ?>

    I will probably put an example for user’s to place the links on their profile templates later on that guide.

    I would love for it to be displayed beneath my avatar and username phpBB-style in topics, or at least on my visible forum profile.

    Yep, there is a way to that too. I can’t remember much but I think it just involves a hook to place the data. There is a plugin Robin made that can basically do that. There is also a different plugin for displaying BuddyPress profile fields. You can dig around the plugins code if you want to see how he did it.

    https://wordpress.org/plugins/bbp-profile-information/

    This doable? Obviously I canโ€™t use the_author_meta() in bbpress, soโ€ฆ

    I think it is possible to just use the WordPress code with bbPress. bbPress is just a plugin of WordPress now.

    Also, instead of adding labels to certain topics. Can I add classes so I can do changes in CSS?

    Yeah you do not have to leave the [status] and just leave the classes there so you can style with just CSS.


    tkse
    Participant

    @tkse

    There is a plugin Robin made that can basically do that. There is also a different plugin for displaying BuddyPress profile fields

    Which one did you link me? What I did, which seems to work fine for now is simply check for the_author_meta and display it if there’s anything there. I placed it within loop-single-reply.php without issues.

    <div class="bbp-reply-author">
    
    <?php do_action( 'bbp_theme_before_reply_author_details' ); ?>
    
    <?php bbp_reply_author_link( array( 'sep' => '<br />', 'show_role' => true ) ); ?>
    
    <?php if ( bbp_is_user_keymaster() ) : ?>
    
    <?php do_action( 'bbp_theme_before_reply_author_admin_details' ); ?>
    
    <div class="bbp-reply-ip"><?php bbp_author_ip( bbp_get_reply_id() ); ?></div>
    
    <?php do_action( 'bbp_theme_after_reply_author_admin_details' ); ?>
    
    <?php endif; ?>
    
    <?php do_action( 'bbp_theme_after_reply_author_details' ); ?>
    		
    <?php if(get_the_author_meta('twitter')):  ?>
    
    <p>Twitter: <?php the_author_meta('twitter'); ?></p>
    
    <?php 
    
    else: 
            // do nothing
    
     endif; ?>
    
    </div><!-- .bbp-reply-author -->

    Yeah you do not have to leave the [status] and just leave the classes there so you can style with just CSS.

    I can’t completely grasp what you’re saying here. Say if I wanna add the class “new-topic” instead of a “new” label. What would I change here?

    function rk_new_topics() {
    $offset = 60*60*1; 
     
       if ( get_post_time() > date('U') - $offset )
          echo '<span class="new">[New]</span>';
    }
     
    add_action( 'bbp_theme_before_topic_title', 'rk_new_topics' );

    I might be saying very stupid things here (gotta learn some way), but I tried changing bbp_theme_before_topic_title to bbp_topic_class which is what my inexperienced self thought would do the trick, but it didn’t.


    Robkk
    Moderator

    @robkk

    Which one did you link me?

    Robin’s plugin for just bbPress fields.

    What I did, which seems to work fine for now…

    Yeah I told you the WordPress code would work. If you want cleaner templates you may nee to use the hook.

    bbp_theme_after_reply_author_details

    I might be saying very stupid things here (gotta learn some way), but I tried changing bbp_theme_before_topic_title to bbp_topic_class which is what my inexperienced self thought would do the trick, but it didnโ€™t.

    Oh, you are trying to make a post class. You can try this to see if it adds a new-topic post class to any new topics. I haven’t tested this though.

    add_filter( 'bbp_get_topic_class','rkk_unread_topic' );
    function rkk_unread_topic($classes) {
    	$offset = 60*60*1; 
    	if ( get_post_time() > date('U') - $offset ) {
    			  $classes[] = 'new-topic';
    		  return $classes;
    	}
    }

    tkse
    Participant

    @tkse

    This added a new class, but not for the first hour after creation only.


    Robkk
    Moderator

    @robkk

    Yeah the code doesn’t really work well.

    You can try to create your own new-topic post class though.

    If you come up with anything just post your result on this topic.

Viewing 14 replies - 1 through 14 (of 14 total)
  • You must be logged in to reply to this topic.
Skip to toolbar