Search Results for 'code'
-
AuthorSearch Results
-
July 22, 2020 at 9:25 am #213123
In reply to: Title “Archives: Forum” – change to read “Forums”?
Robin W
Moderatorthat is a question – you should only have it once, either in your theme function file or in code snippets not in both !
July 22, 2020 at 9:18 am #213120In reply to: Title “Archives: Forum” – change to read “Forums”?
torimc125
ParticipantHi Robin: Thank you again for your reply. I copied the code you provided and pasted it into Code Snippets. Now I get this error message:
“The snippet has been deactivated due to an error on line 3:
Cannot redeclare function to_archive_title_remove_prefix.Any other suggestions?
VictoriaJuly 22, 2020 at 8:38 am #213118In reply to: How to find if um on a topic page
Robin W
ModeratorViewing a single topic
if (bbp_is_single_topic()) {...
and orCheck if current page is a bbPress topic
bbp_is_topic()and also
Check if we are viewing a topic archive.
bbp_is_topic_archive()and
Check if current page is a topic edit page
bbp_is_topic_edit()July 21, 2020 at 12:23 pm #213103In reply to: I want to get the parent forum name/ID of any topic
Robin W
Moderatorok, 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') ;July 21, 2020 at 11:03 am #213100In reply to: I want to get the parent forum name/ID of any topic
nayanboost
ParticipantI 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.
July 21, 2020 at 10:54 am #213096In reply to: bbpress blockquote text color – how to change?
Robert
ParticipantVery 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;
}July 21, 2020 at 10:47 am #213094In reply to: I want to get the parent forum name/ID of any topic
Robin W
Moderatoryou’ll need to give me the context – ie what are you trying to do, and what code do you have so far
July 21, 2020 at 10:45 am #213093In reply to: bbpress blockquote text color – how to change?
Robin W
Moderatormy firewall software doesn’t like your site
try
#bbpress-forums blockquote { color: blue !important; }July 21, 2020 at 10:04 am #213082In reply to: bbpress blockquote text color – how to change?
Robert
ParticipantI 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.
July 21, 2020 at 6:44 am #213070In reply to: I want to get the parent forum name/ID of any topic
Robin W
Moderatorbbp_get_topic_forum_id( $topic_id) ;July 21, 2020 at 6:09 am #213068Topic: I want to get the parent forum name/ID of any topic
in forum Pluginsnayanboost
ParticipantCould 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?
July 21, 2020 at 3:17 am #213065In reply to: bbpress blockquote text color – how to change?
Robin W
Moderatorput this in the custom css part of your theme
blockquote { color: blue; }July 21, 2020 at 3:05 am #213062In reply to: Sync Woocommerce User roles with bbpress site
Robin W
Moderatorbbpress 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
or if you are into coding
How to Share Logins and Users Between Multiple WordPress Sites
July 20, 2020 at 1:39 pm #213041In reply to: Akismet — false positives, grrrr!
Robin W
Moderatorthis 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.
July 20, 2020 at 11:25 am #213030In reply to: Title “Archives: Forum” – change to read “Forums”?
Robin W
Moderatorif 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; }July 20, 2020 at 9:25 am #213027In reply to: Title “Archives: Forum” – change to read “Forums”?
torimc125
ParticipantThank 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 fileWas 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;
}July 19, 2020 at 1:03 pm #213006In reply to: New to bbPress – registration email
Robin W
Moderatorbbpress 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
July 19, 2020 at 9:49 am #212997In reply to: Title “Archives: Forum” – change to read “Forums”?
Robin W
ModeratorPut 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
July 18, 2020 at 11:44 am #212973In reply to: Pagination – How to remove last page numbers?
kriskl
Participantoh 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 templatesI 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
July 18, 2020 at 11:08 am #212971In reply to: Pagination – How to remove last page numbers?
Robin W
Moderatoroh, 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 🙂
July 18, 2020 at 10:50 am #212970In reply to: Pagination – How to remove last page numbers?
Robin W
Moderatoryes, find
wp-content/plugins/bbpress/templates/default/bbpress/content-single-forum.phptransfer 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%/bbpresswhere %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.phpbbPress will now use this template instead of the original
July 18, 2020 at 8:37 am #212964In reply to: Pagination – How to remove last page numbers?
kriskl
Participantyes,
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,843July 18, 2020 at 8:19 am #212962In reply to: Pagination – How to remove last page numbers?
Robin W
Moderatorok, so did you try MY code on another site?
July 18, 2020 at 8:00 am #212960In reply to: Pagination – How to remove last page numbers?
kriskl
Participantyhm,
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' );July 18, 2020 at 7:52 am #212958In reply to: cannot edit, delete or close a topic
Robin W
Moderatorif you change
bottom:15px;to
bottom:1px ;it works
-
AuthorSearch Results