Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 2,751 through 2,775 (of 32,492 total)
  • Author
    Search Results
  • #211363

    In reply to: Make Forum Full Width

    Robin W
    Moderator

    looks pretty full width to me – have you refreshed your browser?

    the theme is setting a width of 90% well before bbpress gets involved.

    you could try

    .both-sidebars .container {
    	width: 100% !important ;
    }

    but that will affect the whole site

    Robin W
    Moderator
    add_action( 'bbp_theme_after_reply_content', 'new_reply_additional_fields', 10 );
    function new_reply_additional_fields() {
    $new_reply_additional_fields = 'Above is my personal opinion';
    	echo "<p id='new_reply_additional_fields'><font color=red font size='4pt'>".$new_reply_additional_fields."</p>";	
    }
    #211360
    jayapramod
    Participant

    Nothing changed… I applied this as:

    1. created child theme folder in my — wp-content >> themes >> astra-child

    2. created functions.php file inside that folder with provided code.

    3. Showed in themes list.

    On viewing my discussion page nothing changed.

    g28f99
    Participant

    Thank you again!
    I also hope to add specified sentence after user personalized replies.

    
    add_action( 'bbp_theme_after_reply_content', 'new_reply_additional_fields', 10 );
    function new_reply_additional_fields() {
    $new_reply_additional_fields = 'Above is my personal opinion';
    	echo "<p id='new_reply_additional_fields'><font color=red font size='4pt'>$new_reply_additional_fields</p>";	
    

    Using above code directly also induce wordpress website error. To permanently show above sentence after every reply, I suppose it should be saved into metabox. Could you please help manage how to integrated into above code to solve this problem?

    #211358
    BGNMGUY
    Participant

    I would like to make my forum full width on all devices but I am unsure how to do so, even after viewing other forum posts and using their tips. Can someone please help me with code that will solve this problem? Thanks in advance!

    Link to my forum: https://vetteenthusiast.com/forums/forum/the-fiberglass-forum/

    #211357
    kasperdalkarl
    Participant

    Thanks again for your amazing help!

    I did as you asked, and I realized a few things.

    Adding your code in form-reply.php only changed how it looks in the reply form, i.e. when you open a thread and scroll down to the actual box where you write replies.

    What I realised is that “Reply To:” that shows in the forums is actually not from code, it’s automatically added to the topic name when someone answers a thread.
    Reply to

    So the follow up question is, can you somehow in bbpress change so replies doesn’t add “Reply To”, I would like to change it to the Swedish equivalent: “Svar till:”. And is it possible then to add what we tried earlier with the avatar+name in front of the name of the topic reply?

    Thanks a lot!

    #211355
    Robin W
    Moderator

    ok so change

    <div class="nk-gap-2"></div>

    to

    <div class="nk-gap-2"></div>
    		<?php
    		$reply_id = bbp_get_topic_last_reply_id () ;
    		echo '<span class="bbp-reply-author">'.bbp_get_reply_author_link( array( 'post_id' => $reply_id, 'type' => 'both', 'size' => 14 ) ) ;
    		?>
    #211353
    kasperdalkarl
    Participant

    Hi again!

    I managed to find it now. It’s here:
    wp-content/themes/godlike/bbpress/form-reply.php

    <?php if (bbp_is_reply_edit()) : ?>
    
    <div id="bbpress-forums">
    
        <?php endif; ?>
    
        <?php if (bbp_current_user_can_access_create_reply_form()) : ?>
            <div class="nk-gap-2"></div>
            <h3 class="h4"><?php printf(esc_html__('Reply To: %s', 'godlike'), bbp_get_topic_title()); ?></h3>
            <div class="nk-gap-1"></div>
            <div id="new-reply-<?php bbp_topic_id(); ?>" class="bbp-reply-form nk-box-3 bg-dark-1">
    
                <form id="new-post" name="new-post" method="post" class="nk-form" action="<?php the_permalink(); ?>">
    
                    <?php do_action('bbp_theme_before_reply_form'); ?>
    
                    <fieldset class="bbp-form">
    
                        <?php do_action('bbp_theme_before_reply_form_notices'); ?>
    
                        <?php if (!bbp_is_topic_open() && !bbp_is_reply_edit()) : ?>
    
                            <?php echo do_shortcode('[nk_info_box icon="fa fa-exclamation-circle" show_close_button="true" class="bg-main-1"]' . esc_html__('This topic is marked as closed to new replies, however your posting capabilities still allow you to do so.', 'godlike') . '[/nk_info_box]'); ?>
    
                        <?php endif; ?>
    #211349
    Robin W
    Moderator

    ok, hopefully that’s just a refinement of order

    try changing

    add_action ('bbp_theme_before_topic_started_by' , 'rew_reply_author' , 10 ) ;

    to

    add_action ('bbp_theme_before_topic_started_by' , 'rew_reply_author' , 5 ) ;

    or

    add_action ('bbp_theme_before_topic_started_by' , 'rew_reply_author' , 15 ) ;

    #211348
    kasperdalkarl
    Participant

    Hi there!
    Thanks for the help! I added it using Code Snippets, and now the last reply author’s name appears in front of “Started by”, as you can see on this link here: https://www.talanrien.com/rollspel/

    Maybe with some minor adjustment it could appear in front of “Reply To”. Thanks for your amazing help!

    #211345
    Robin W
    Moderator

    ok, they’ve done it by a function by the look of it.

    so try this

    add_action ('bbp_theme_before_topic_started_by' , 'rew_reply_author' , 10 ) ;
    
    function rew_reply_author () {
    	$reply_id = bbp_get_topic_last_reply_id () ;
    	echo '<span class="bbp-reply-author">'.bbp_get_reply_author_link( array( 'post_id' => $reply_id, 'type' => 'both', 'size' => 14 ) ) ;
    }

    Put this in your child theme’s function file – or use

    Code Snippets

    then come back and let me know where this appears, we might need to adjust

    Robin W
    Moderator

    just overwrite your code with the above – that code works

    Robin W
    Moderator
    add_action( 'bbp_theme_before_reply_form_content', 'rew_additional_field' );
    function rew_additional_field($post){
    	?>
    	<select name="rew_additional_field" id="rew_additional_field">
    		<option value="enqury">Enquiry</option>
    		<option value="complaint">Complaint</option>
    		<option value="feedback">Feedback</option>
    	</select>
    	
    	
    	<select name="rew_additional_field_2" id="rew_additional_field_2">
    		<option value="enqury2">Enquiry2</option>
    		<option value="complaint2">Complaint2</option>
    		<option value="feedback2">Feedback2</option>
    	</select>
    	<?php
    }
     
    
    add_action('bbp_new_reply_post_extras', 'rew_save_additional_field');
    
    function rew_save_additional_field($reply_id){ 
        global $post;
        if(isset($_POST["rew_additional_field"])) {
            update_post_meta ($reply_id, 'rew_additional_field', $_POST["rew_additional_field"]) ;
    	}
        if(isset($_POST["rew_additional_field_2"])) {
            update_post_meta ($reply_id, 'rew_additional_field_2', $_POST["rew_additional_field_2"]) ;
    	}
    }
    
    add_action('bbp_theme_before_reply_content', 'rew_show_additional_field');
    
    function rew_show_additional_field () {
    $reply_id = bbp_get_reply_id();
    	$field = get_post_meta($reply_id, 'rew_additional_field', true);
    	if (!empty ($field)) {
    		echo "Type: ". ucfirst($field)."<br>"; 
    	}	
    	$field_2 = get_post_meta($reply_id, 'rew_additional_field_2', true);
    	if (!empty ($field_2)) {
    		echo "Type: ". ucfirst($field_2)."<br>";  
    	}
    }
    g28f99
    Participant

    But I found a new problem. I hope more than one selection box will be shown there.
    And there will be errors. Could you please kindly suggest solutions?

    
    add_action( 'bbp_theme_before_reply_form_content', 'rew_additional_field' );
    function rew_additional_field($post){
    	?>
    	<select name="rew_additional_field" id="rew_additional_field">
    		<option value="enqury">Enquiry</option>
    		<option value="complaint">Complaint</option>
    		<option value="feedback">Feedback</option>
    	</select>
    	
    	
    	<select name="rew_additional_field_2" id="rew_additional_field_2">
    		<option value="enqury2">Enquiry2</option>
    		<option value="complaint2">Complaint2</option>
    		<option value="feedback2">Feedback2</option>
    	</select>
    	<?php
    }
     
    
    add_action('bbp_new_reply_post_extras', 'rew_save_additional_field');
    
    function rew_save_additional_field($reply_id){ 
        global $post;
        if(isset($_POST["rew_additional_field"])) {
            update_post_meta ($reply_id, 'rew_additional_field', $_POST["rew_additional_field"]) ;
    		
        if(isset($_POST["rew_additional_field_2"])) {
            update_post_meta ($reply_id, 'rew_additional_field_2', $_POST["rew_additional_field_2"]) ;
    	}
    }
    
    add_action('bbp_theme_before_reply_content', 'rew_show_additional_field');
    
    function rew_show_additional_field () {
    $reply_id = bbp_get_reply_id();
      $field = get_post_meta($reply_id, 'rew_additional_field', true);
      if (!empty ($field)) {
    	echo "Type: ". ucfirst($field)."<br>";  
    	
      $field_2 = get_post_meta($reply_id, 'rew_additional_field_2', true);
      if (!empty ($field_2)) {
    	echo "Type: ". ucfirst($field_2)."<br>";  
      }
    }
    
    
    #211333
    kasperdalkarl
    Participant

    It probably comes from the theme I have, it currently looks like this in loop-single-topic:

       <div class="nk-forum-title-sub">
    
          
            <?php
            $link_url = bbp_get_topic_last_reply_url();
            $title = bbp_get_topic_last_reply_title();
            ?>
            <div class="nk-forum-activity-title" title="<?php echo esc_attr($title); ?>">
                <a href="<?php echo esc_url($link_url); ?>"><?php echo esc_html($title); ?></a>
            </div>
            
            
             <div class="nk-forum-activity-date">
                <?php do_action('bbp_theme_before_topic_freshness_link'); ?>
                <?php $time_since = bbp_get_topic_last_active_time();
                if (!empty($time_since)) {
                    echo esc_html($time_since);
                } else {
                    echo esc_html__('No Replies', 'godlike');
                }
                ?>
                <?php do_action('bbp_theme_after_topic_freshness_link'); ?>
            </div>
               
    
                <?php do_action('bbp_theme_before_topic_started_by'); ?>
    
                <span
                    class="bbp-topic-started-by"><?php printf(esc_html__('Started by %1$s', 'godlike'), bbp_get_topic_author_link(array('type' => 'name')), bbp_get_reply_post_date()); ?></span>
    
                <?php do_action('bbp_theme_after_topic_started_by'); ?>
    
                <?php if (!bbp_is_single_forum() || (bbp_get_topic_forum_id() !== bbp_get_forum_id())) : ?>
    
                    <?php do_action('bbp_theme_before_topic_started_in'); ?>
    
                    <span
                        class="bbp-topic-started-in"><?php printf(__('in: <a href="%1$s">%2$s</a>', 'godlike'), bbp_get_forum_permalink(bbp_get_topic_forum_id()), bbp_get_forum_title(bbp_get_topic_forum_id())); ?></span>
    
                    <?php do_action('bbp_theme_after_topic_started_in'); ?>
    
                <?php endif; ?>
    
            </div>
    Robin W
    Moderator

    easier to start again

    this works

    add_action( 'bbp_theme_before_reply_form_content', 'rew_additional_field' );
    function rew_additional_field($post){
    	?>
    	<select name="rew_additional_field" id="rew_additional_field">
    		<option value="enqury">Enquiry</option>
    		<option value="complaint">Complaint</option>
    		<option value="feedback">Feedback</option>
    	</select>
    	<?php
    }
     
    
    add_action('bbp_new_reply_post_extras', 'rew_save_additional_field');
    
    function rew_save_additional_field($reply_id){ 
        global $post;
        if(isset($_POST["rew_additional_field"])) {
            update_post_meta ($reply_id, 'rew_additional_field', $_POST["rew_additional_field"]) ;
    	}
    }
    
    add_action('bbp_theme_before_reply_content', 'rew_show_additional_field');
    
    function rew_show_additional_field () {
    $reply_id = bbp_get_reply_id();
      $field = get_post_meta($reply_id, 'rew_additional_field', true);
      if (!empty ($field)) {
    	echo "Type: ". ucfirst($field)."<br>";  
      }
    }
    #211328
    Robin W
    Moderator

    quickest way is

    add_filter(  'gettext',  'rew_bbpress_translate', 20 , 3  );
    
    function rew_bbpress_translate( $translated, $text, $domain ) {
    	if ($domain == 'bbpress') {
         $words = array(
                            
                            'Website' => 'WhatsApp no'
                 );
         $translated = str_replace(  array_keys($words),  $words,  $translated );
    	}
    
         return $translated;
    }

    Put this in your child theme’s function file – or use

    Code Snippets

    #211326
    hrithik951
    Participant

    When using this shortcode- [bbp-topic-form]

    It’s working.

    There are total 3 files named form-topic.php you would have to remove it from all three to remove (default forum). One is in the Bbpress plugin, other in the theme and one somewhere else (use Search function). It’s on line 128 in all three files if memory serves right.

    Robin W
    Moderator

    ok, I’ve ONLY edited this to correct syntax, but try it and then come back

    add_action( 'bbp_theme_before_reply_form_content', 'so_additional_content' );
    function so_additional_content($post){
    	$reply_id = bbp_get_reply_id();
        $meta_element_class = get_post_meta($reply_id, 'custom_element_grid_class_meta_box', true); //true ensures you get just one value instead of an array
         echo '<label>Choose the size of the element :  </label>' ;
    	?> 
        <select name="custom_element_grid_class" id="custom_element_grid_class">
          <option value="normal" <?php selected( $meta_element_class, 'normal' ); ?>>normal</option>
          <option value="square" <?php selected( $meta_element_class, 'square' ); ?>>square</option>
          <option value="wide" <?php selected( $meta_element_class, 'wide' ); ?>>wide</option>
          <option value="tall" <?php selected( $meta_element_class, 'tall' ); ?>>tall</option>
        </select>'
        <?php
    }
     
    
     
    add_action('bbp_new_reply_post_extras', 'so_save_metabox');
    
    function so_save_metabox(){ 
        global $post;
        if(isset($_POST["custom_element_grid_class"])) {
             //check the capability: if ( !current_user_can( 'edit_post', $post->ID ))  return $post->ID;
            $meta_element_class = $_POST['custom_element_grid_class'];
            //END OF UPDATE
    
            update_post_meta($reply_id, 'custom_element_grid_class_meta_box', $meta_element_class);
            //print_r($_POST);
    		
        }
    }
    
    add_action('bbp_theme_before_reply_content', 'so_show_metabox');
    
    function so_show_metabox() {
      $meta_element_class = get_post_meta($reply_id, 'custom_element_grid_class_meta_box', true);
      // the problem is "Field 1" appear in every reply post
      echo "Field 1: ". $meta_element_class."<br>";  
    }
    g28f99
    Participant

    Thank you, Robin!
    I made some corrections and further checked the selection option parts accordingly. I also add a show contents part referring to a workable previous post with link.
    The code can provide options for the user to selection. But the selection result could not be shown. I am not sure whether the selection result was added into metabox properly because I can not use the debug function. And another problem is that the “Field 1 ” was inserted into all previous replies.
    Could you further provide help to solve this problem?

    
    add_action( 'bbp_theme_before_reply_form_content', 'so_additional_content' );
    function so_additional_content($post){
    	$reply_id = bbp_get_reply_id();
        $meta_element_class = get_post_meta($reply_id, 'custom_element_grid_class_meta_box', true); //true ensures you get just one value instead of an array
        ?>   
        echo '<label>Choose the size of the element :  </label>
    
        <select name="custom_element_grid_class" id="custom_element_grid_class">
          <option value="normal" <?php selected( $meta_element_class, 'normal' ); ?>>normal</option>
          <option value="square" <?php selected( $meta_element_class, 'square' ); ?>>square</option>
          <option value="wide" <?php selected( $meta_element_class, 'wide' ); ?>>wide</option>
          <option value="tall" <?php selected( $meta_element_class, 'tall' ); ?>>tall</option>
        </select>'
        <?php
    }
     
    
     
    add_action('bbp_new_reply_post_extras', 'so_save_metabox');
    
    function so_save_metabox(){ 
        global $post;
        if(isset($_POST["custom_element_grid_class"])) {
             //check the capability: if ( !current_user_can( 'edit_post', $post->ID ))  return $post->ID;
            $meta_element_class = $_POST['custom_element_grid_class'];
            //END OF UPDATE
    
            update_post_meta($reply_id, 'custom_element_grid_class_meta_box', $meta_element_class);
            //print_r($_POST);
    		
        }
    }
    
    add_action('bbp_theme_before_reply_content', 'so_show_metabox');
    
    function so_show_metabox() {
      $meta_element_class = get_post_meta($reply_id, 'custom_element_grid_class_meta_box', true);
      // the problem is "Field 1" appear in every reply post
      echo "Field 1: ". $meta_element_class."<br>";  
    }
    
    
    #211306
    Robin W
    Moderator

    1. Download the plugin from this url :

    Fix forum


    Then upload to your site and activate

    3. Create a page called anything and put this shortcode in it
    [fix-topics]
    and publish

    4. Go to this page and you will see a drop down, use the drop down to select ‘run’ and click submit

    That should do it

    #211298
    Pete
    Participant

    Thanks again @robin-w. Yes, I saw that one. That does work as long as the text that’s being replaced is ‘Howdy’. but that’s language dependent. Down here, if your site is configured for Australia, it’s ‘G’day’ and in other countries I imagine it’s something different again (and that code works as long as you specify the exact string that you need to replace).

    I was actually wanting to get rid of that text altogether, in a language-independent way, so I was hoping that it had a ‘name’, like ‘wp-user-greeting’ or something that you could just do a $wp_adminbar->remove_node on, but it sounds like this is not the case. Is the format of the username/avitar on the admin-bar on this site, where there’s no ‘prefix’ at all, really hard coded (rather than managed through something like a function)?

    I am making progress with the code (to identify a user as anonymous before they log in) from your previous response, so thanks again for that, but I’m modifying files that are bound to be replaced with the next WordPress/bbPress update. There must surely be some ‘version independent’ way of doing this…

    #211289
    Robin W
    Moderator

    you can only enqueue a style name once, so suggest you rename the second child one eg

    wp_enqueue_style( 'child-theme-css', get_stylesheet_directory_uri() .'/style.css' , array('parent-style'));
      wp_enqueue_style( 'child-theme-bbpress-css', get_stylesheet_directory_uri() .'/css/bbpress.css', array());

    that might be the problem, if not, it certainly isn’t helping

    #211285
    Robin W
    Moderator

    Haven’t tested but googled and found this

    add_filter( 'admin_bar_menu', 'replace_wordpress_howdy', 25 );
    function replace_wordpress_howdy( $wp_admin_bar ) {
    $my_account = $wp_admin_bar->get_node('my-account');
    $newtext = str_replace( 'Howdy,', 'Welcome,', $my_account->title );
    $wp_admin_bar->add_node( array(
    'id' => 'my-account',
    'title' => $newtext,
    ) );
    }

    Put this in your child theme’s function file – or use

    Code Snippets

    #211280
    danielthorpe
    Participant

    Thanks, tried it and it is better.

    Here is a test page:

    https://eliteguitarist.net/forums/

    I cant get the users avatar to show up bigger, and Id like to remove the “home” button, “viewing topic” text, remove the “create a new topic” button, make the box where they type in smaller and remove the section at the bottom where it says “You may use these HTML tags and attributes:”

    Sorry, that`s a lot. Is this all possible using the plugin?

Viewing 25 results - 2,751 through 2,775 (of 32,492 total)
Skip to toolbar