Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 2,501 through 2,525 (of 32,462 total)
  • Author
    Search Results
  • #213103
    Robin W
    Moderator

    ok, without getting heavily involved in coding a solution for you (which is my paid day job 🙂 ) I guess that you have hooked to ‘template redirect’ which fires on everypage, so when WordPress displays the test-page it looks again for a value of topic_id, which on the test page does not exist, so returns zero.

    if your code is working in that it redirects to test page, then you could try appending the topic id and picking that up in $_REQUEST

    eg (untested)

    wp_redirect('/test-page/?topic_id='.bbp_get_topic_id());

    and then on test page use the code

    if (isset($_REQUEST['topic_id'])) $topic_id = $_REQUEST('topic_id') ;

    #213100
    nayanboost
    Participant

    I am writing this code in functions.php and when I am trying to dump data using
    print_r (bbp_get_topic_id());

    It is returning 0.

    When the above mentioned condition is met I will redirect to another page.

    function test_rdr (){
        if (bbp_get_topic_forum_id(bbp_get_topic_id()) == ‘ID of the Parent forum’){
            wp_redirect('/test-page');
            exit;
        }
    }
    add_action('template_redirect', 'test_rdr')

    Please help me to get over with it.

    #213096
    Robert
    Participant

    Very strange… so I tried adding the code you suggested in the css section of my word press theme, and it didn’t work.

    So I made a change to the css code in SiteOrigin css and added “!important” and that worked, see code below…

    blockquote p {
    color: blue !important;
    border-width: 1px;
    border-style: solid;
    border-color: #e6e6e6;
    background-color: #000000;
    }

    #213094
    Robin W
    Moderator

    you’ll need to give me the context – ie what are you trying to do, and what code do you have so far

    #213093
    Robin W
    Moderator

    my firewall software doesn’t like your site

    try

    #bbpress-forums blockquote {
    	color: blue !important;
    }
    #213082
    Robert
    Participant

    I even installed the plugin SiteOrigin CSS to try and change the blockquote, but still no luck, see code below…

    blockquote p {
    color: blue;
    border-width: 1px;
    border-style: solid;
    border-color: #e6e6e6;
    background-color: #000000;
    }

    It seems the code for the blockquote is being over ridden somewhere.

    #213070
    Robin W
    Moderator

    bbp_get_topic_forum_id( $topic_id) ;

    #213068
    nayanboost
    Participant

    Could you please tell me how I can get the parent forum name/ID of current topic/any topic? I need code implementation. How to get so by code?

    #213065
    Robin W
    Moderator

    put this in the custom css part of your theme

    blockquote {
    	color: blue;
    }
    #213062
    Robin W
    Moderator

    bbpress just uses WordPress login, so you just need a plugin or code that does that for WordPress

    there are several and I have not tried any, but

    Home

    or if you are into coding

    How to Share Logins and Users Between Multiple WordPress Sites

    #213041
    Robin W
    Moderator

    this is one of the good and bad things about WordPress plugins.

    It is good that they warn you that plugins have not been updated for a long period.

    It is bad that it puts people off using perfectly good plugins because the author has had the goodness to release for free useful code to the world, but does not have the time or wish to be involved in supporting it.

    But a well written plugin rarely needs changing if it does all that is required.

    And since moderation tools hooks to bbpress functions that are long standing and stable, there are no issues I know with this plugin and I suspect it will work for years to come. If it breaks though minor issues, I’d clone it and re-issue.

    You can sort of consider the warning a bit like a warranty. You don’t stop using the dishwasher because the year long warranty has run out, you just accept that maybe one day in the future it will stop working. When it does, then you may need to stop using it, but you do not go back to hand washing your dishes just because the warranty has run out on the dishwasher 🙂

    If moderation tools stops working, you are no worse off than now. so if you use it for a while and it makes life easier, then that is a bonus.

    Robin W
    Moderator

    if you are using code snippets, then JUST the code below (not the “wp-content/theme” etc – do NOT add that) , and use this code as it has the correct apostrophies in it

    add_filter( 'get_the_archive_title', 'to_archive_title_remove_prefix' );
    function to_archive_title_remove_prefix( $title ) {
    if ( is_post_type_archive() ) {
    $title = post_type_archive_title( '', false );
    }
    return $title;
    }
    torimc125
    Participant

    Thank you, Robin, for your reply. I downloaded Code Snippets and I added the above line, you provided, wp-content/themes/%your-theme-name%/functions.php. I changed %your-theme-name% to my theme, but I receive this fatal error.

    Don’t Panic
    The code snippet you are trying to save produced a fatal error on line 1:
    syntax error, unexpected end of file

    Was I supposed to add the below to code snippet?

    add_filter( ‘get_the_archive_title’, ‘to_archive_title_remove_prefix’ );
    function to_archive_title_remove_prefix( $title ) {
    if ( is_post_type_archive() ) {
    $title = post_type_archive_title( ”, false );
    }
    return $title;
    }

    #213006
    Robin W
    Moderator

    bbpress just uses WordPress registration and login.

    bbpress then just assigns the default role on first login that is set in Dashboard>settings>forum>roles if you have that ticked, or you can manually assign if you wish.

    Therefore you can ignore anything bbpressy on registration and login, and just use anything that WordPress does instead.

    This gives you the ability to utilise plugins such as ‘theme my login’ to give yourself a nice registration and login (there are plenty of other good login plugins, just search around).

    It looks like you have already changed the default wp urls – which is great and good security practise, so suggest you just don’t use bbpress login shortcodes or widgets, and let wordpress do your registration and login.

    Do come back if you need further help

    Robin W
    Moderator

    Put this in your child theme’s function file –

    ie wp-content/themes/%your-theme-name%/functions.php

    where %your-theme-name% is the name of your theme

    or use

    Code Snippets

    #212973
    kriskl
    Participant

    oh Robin, you are a star! 🙂

    the code did wonders.

    I’ll leave the dots as they make sense when going through the pages later.. so it’s consistent.

    and thanks! I was so silly, not realising about editing out the code
    <?php bbp_get_template_part( ‘pagination’, ‘topics’ ); ?>
    in templates

    I thought there was some function code trick :))

    I hope you have a nice weekend, thanks again!

    ps. maybe you should add this filter as an option
    add_filter (‘bbp_before_paginate_links_parse_args’ , ‘rew_pagintion’ ) ;

    in your plugin?

    it seems many users might find it useful

    #212971
    Robin W
    Moderator

    oh, and I found a bit where we can do some string editing, so…

    This code reduces the last to 1 entry, and then looks for that entry and removes it…

    add_filter ('bbp_before_paginate_links_parse_args' , 'rew_pagintion' ) ;
    
    function rew_pagintion ($args) {
    	$args['end_size'] = 0 ;
    return $args;
    }
    
    add_filter ('bbp_make_first_page_canonical', 'rew_take_out_last', 10 ,2) ;
    
    function rew_take_out_last ($retval, $pagination_links) {
    	$posf = strrpos ($pagination_links, '<a class="page-numbers' ) ;
    	$posl = strpos ($pagination_links, '<a class="next page-numbers' ) ;
    	$start = substr ($pagination_links, 0 , $posf) ;
    	$end = substr ($pagination_links, $posl , strlen($pagination_links)) ;
    	$links = $start.$end ;
    return $links ;
    }

    you can get rid of the page number dots using css or some more str functions in the code above, but I’ll leave you to work that out 🙂

    #212970
    Robin W
    Moderator

    yes, find
    wp-content/plugins/bbpress/templates/default/bbpress/content-single-forum.php

    transfer this to your pc and edit

    you’ll see

    <?php bbp_get_template_part( 'pagination', 'topics'    ); ?>
    
    <?php bbp_get_template_part( 'loop',       'topics'    ); ?>
    
    <?php bbp_get_template_part( 'pagination', 'topics'    ); ?>

    change that to take out the first line and save

    create a directory on your theme called ‘bbpress’
    ie wp-content/themes/%your-theme-name%/bbpress

    where %your-theme-name% is the name of your theme

    Then transfer the file you saved above and put in in the directory called bbpress that you created above, so you end up with
    wp-content/themes/%your-theme-name%/bbpress/content-single-forum.php

    bbPress will now use this template instead of the original

    #212964
    kriskl
    Participant

    yes,

    I have disabled all plugins but BBpress. and changed to WordPress default theme.
    with your code
    this is what it looks like:

    1 2 … 2,843 →
    it still shows the last page: 2,843

    https://opendev.leetdns.com/forums/

    #212962
    Robin W
    Moderator

    ok, so did you try MY code on another site?

    #212960
    kriskl
    Participant

    yhm,
    I will try on another test site
    maybe some plugin conflict..
    here is some code above and below

    //ONLY BBPress below
    //create vertical list subforum layout
    function custom_bbp_sub_forum_list() {
      $args['separator'] = '
    ';
      return $args;
    }
     add_filter('bbp_after_list_forums_parse_args', 'custom_bbp_sub_forum_list' );
     
    
    function ra_bbp_increase_pagination($args) {
        $args['end_size'] = 0;
        $args['mid_size'] = 3;
        return $args;
    }
    add_filter( 'bbp_topic_pagination', 'ra_bbp_increase_pagination' );
    
    function rk_hot_topics() {
       $reply_count = bbp_get_topic_reply_count();
      
       if ( $reply_count > 5 )
          echo '<span class="hot">HOT</span>';
    }
      
    add_action( 'bbp_theme_before_topic_title', 'rk_hot_topics' );
    #212958
    Robin W
    Moderator

    if you change
    bottom:15px;

    to

    bottom:1px ;

    it works

    #212957
    Robin W
    Moderator

    yes your theme has a style sheet

    wplms/assets/css/bbpress.min.css

    which contains

    #bbpress-forums ul.bbp-forums li.bbp-body .reply .bbp-reply-header .bbp-admin-links,
    #bbpress-forums ul.bbp-forums li.bbp-body div.hentry .bbp-reply-header .bbp-admin-links,
    #bbpress-forums ul.bbp-replies li.bbp-body .reply .bbp-reply-header .bbp-admin-links,
    #bbpress-forums ul.bbp-replies li.bbp-body div.hentry .bbp-reply-header .bbp-admin-links,
    #bbpress-forums ul.bbp-topics li.bbp-body .reply .bbp-reply-header .bbp-admin-links,
    #bbpress-forums ul.bbp-topics li.bbp-body div.hentry .bbp-reply-header .bbp-admin-links {
     position:absolute;
     bottom:15px;
     right:0
    }

    which moves the links, and makes them unclickable

    #212956
    kriskl
    Participant

    hi,

    yes it is in the correct child theme 🙂

    I have also tried this code – which seems similar to yours, and I can make more page numbers – front and end. but I can’t remove the end with 0

    function ra_bbp_increase_pagination($args) {
        $args['end_size'] = 0;
        $args['mid_size'] = 2;
        return $args;
    }
    add_filter( 'bbp_topic_pagination', 'ra_bbp_increase_pagination' );
    #212954
    Robin W
    Moderator

    so the functions.php file that is in your child theme – yes ? (sorry but the obvious questions so often lead me to a solution!)

    and can you paste the code with say the function above or below it, so I can check that it is not erroring due to syntax.

Viewing 25 results - 2,501 through 2,525 (of 32,462 total)
Skip to toolbar