Skip to:
Content
Pages
Categories
Search
Top
Bottom

Can't change css for reply-content without changing topic-content


  • Jerry
    Participant

    @jerrysc

    I am using wordpress 3.9.1, buddypress 2.0.1, and bbpress 2.5.3. I am using child themes. I cannot change the css for bbp-reply-content without changing bbp-topic-content. Around line 315 in bbpress.css, if I change something for bbp-reply-content, that changes the reply and topic content. For example, in the below changes nothing happens. I have background color set to white, and the background for repy-content is commented out. If I comment out topic-content and use the background change for reply-content, then all topic content and reply content will have a white background. I would like to be able to change the background on the reply content and NOT on the topic content. Anyone have any thoughts on this?

    #bbpress-forums div.bbp-topic-content{
      margin-left: 130px;
    	padding: 12px 12px 12px 0;
    	text-align: left;
      background-color: white;
    }
    #bbpress-forums div.bbp-reply-content {
    	margin-left: 130px;
    	padding: 12px 12px 12px 0;
    	text-align: left;
      /*border:5px solid red;*/
      /*border: 11px ridge #7D573A;*/
      /*background-color: white;*/
    }
    
Viewing 7 replies - 1 through 7 (of 7 total)

  • Robin W
    Moderator

    @robin-w

    I’d be fairly sure that it’s because a topic and replies are shown using loop-single-reply.php which uses the reply class throughout.

    I suspect that the topic class is used in /topics display

    http://www.mysite.com/topics

    you could prove this by typing the above (with your site name!) into your url box.

    If so, then you could put a conditional into loop-single reply using the $countr we out there earlier, ie if it’s the first use topic class.

    http://bbpress.org/forums/topic/is-it-possible-to-remove-topic-author-but-keep-reply-authors/

    I’m just on my way out, or I’d do a bit more research – come back if you need more help !


    Jerry
    Participant

    @jerrysc

    Thanks Robin! Once again you led me down the correct path. I might post a much more difficult question next, so if you are still willing I would love your continued help. In the event that someone else needs this solution, below is my entire content for loop-single-reply.php. I inserted comments for the if and else statements to hopefully make it self-explanatory. Cheers!

    <?php
    
    /**
     * Replies Loop - Single Reply
     *   Modified by Jerry for the Book Review site
     *   need the global $countr variable for use below,
     *   which is incremented in loop-replies.php
     * @package bbPress
     * @subpackage Theme
     */
    global $countr;
    /* this variable $countr is incremented in loop replies with the following code:
    while ( bbp_replies() ) : bbp_the_reply(); $countr++;  the $countr variable is set
    to zero $countr=0;, before the while loop. */?>
    
    <?php //Adding an if statement to show reply headers ONLY for reviews, not for initial topic
    if ($countr > 1) {  ?>
    
    <div id="post-<?php bbp_reply_id(); ?>" class="bbp-reply-header">
    
    	<div class="bbp-meta">
    
    		<span class="bbp-reply-post-date"><?php bbp_reply_post_date(); ?></span>
    
    		<?php if ( bbp_is_single_user_replies() ) : ?>
    
    			<span class="bbp-header">
    				<?php _e( 'in reply to: ', 'bbpress' ); ?>
    				<a class="bbp-topic-permalink" href="<?php bbp_topic_permalink( bbp_get_reply_topic_id() ); ?>"><?php bbp_topic_title( bbp_get_reply_topic_id() ); ?></a>
    			</span>
    
    		<?php endif; ?>
    
    		<a href="<?php bbp_reply_url(); ?>" class="bbp-reply-permalink">#<?php bbp_reply_id(); ?></a>
    
    		<?php do_action( 'bbp_theme_before_reply_admin_links' ); ?>
        
    		<?php bbp_reply_admin_links(); ?>
    
    		<?php do_action( 'bbp_theme_after_reply_admin_links' ); ?>
    
    	</div><!-- .bbp-meta -->
    
    </div><!-- #post-<?php bbp_reply_id(); ?> -->   <?php }  //this is the closing bar for the if statement
        //this display the word Description where normally the title bar would be, then the else statement is
        //what displays the word Description
    else { ?>  <center><strong><span style="font-size: 14px"; >Description </span></strong></center>  <?php } ?>
    
    <?php if ($countr > 1) {  /* this if statement is to separate css class replies from topics */ ?>
    
    <div <?php bbp_reply_class(); ?>>
    
    	<div class="bbp-reply-author">
    
    		<?php do_action( 'bbp_theme_before_reply_author_details' ); ?>
        
        <?php /*commented out by Jerry - this was for trouble-shooting purposes echo 'countr is ' . $countr;  */?>
    
    		<?php if ($countr > 1) 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' ); ?>
    
    	</div><!-- .bbp-reply-author -->
    
    	<div class="bbp-reply-content">
    
    		<?php do_action( 'bbp_theme_before_reply_content' ); ?>
    
    		<?php bbp_reply_content(); ?>
    
    		<?php do_action( 'bbp_theme_after_reply_content' ); ?>
    
    	</div><!-- .bbp-reply-content -->   
      
    </div><!-- .reply -->
     <?php }
      
      else {  /* this else statement is to separate css class topics from replies. The below
      class calls and div classes were changed from reply to topic or content as required. */   ?>
      
      <div <?php bbp_topic_class(); ?>>
    
    	<div class="bbp-content-author">
    
    		<?php do_action( 'bbp_theme_before_content_author_details' ); ?>
        
        <?php /*commented out by Jerry - this was for trouble-shooting purposes echo 'countr is ' . $countr;  */?>
    
    		<?php if ($countr > 1) bbp_reply_author_link( array( 'sep' => '<br />', 'show_role' => true ) ); ?>
    
    		<?php if ( bbp_is_user_keymaster() ) : ?>
    
    			<?php do_action( 'bbp_theme_before_content_author_admin_details' ); ?>
    
    			<div class="bbp-reply-ip"><?php bbp_author_ip( bbp_get_reply_id() ); ?></div>
    
    			<?php do_action( 'bbp_theme_after_content_author_admin_details' ); ?>
    
    		<?php endif; ?>
    
    		<?php do_action( 'bbp_theme_after_content_author_details' ); ?>
    
    	</div><!-- .bbp-content-author -->
    
    	<div class="bbp-topic-content">
    
    		<?php do_action( 'bbp_theme_before_topic_content' ); ?>
    
    		<?php bbp_topic_content(); ?>
    
    		<?php do_action( 'bbp_theme_after_topic_content' ); ?>
    
    	</div><!-- .bbp-topic-content -->   
      
    </div><!-- .content-->  <?php } ?>

    Jerry
    Participant

    @jerrysc

    I should also mention, for anyone who finds this useful, that I made these changes within my theme files, not within the core bbpress files. Any changes made to the core bbpress files will likely be lost on an upgrade.


    Robin W
    Moderator

    @robin-w

    Brilliant – thanks for posting the solution, I’ve saved it away in my file of useful bbpress stuff !

    more difficult question now expected !


    Jerry
    Participant

    @jerrysc


    Robin W
    Moderator

    @robin-w

    Not sure I asked !!!, but will take a look tomorrow – wine and steak currently await !


    Jerry
    Participant

    @jerrysc

    Very nice! I had wine and steak last night. We will probably get snipped at for chatting on these boards, so I’ll stop now. Thanks again for your help today.

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

You must be logged in to reply to this topic.