Search Results for 'code'
-
AuthorSearch Results
-
December 24, 2020 at 4:59 am #216927
In reply to: Help In Configuring BBpress
Robin W
ModeratorProbably a theme issue, so do you have the shortcode [bbp-forum-index] in your forums page ?
December 23, 2020 at 3:32 pm #216920In reply to: First Post of Forum Topic On Page
erich199
Participant@robin-w , I must have misread what you posted then. I’ll go back and take a look. I was using the shortcode
[bsp-display-topic-index show=’1′ forum =’10’ template = ‘short’ show_stickies=’true’ noreply=’true’]
December 23, 2020 at 2:57 pm #216918In reply to: First Post of Forum Topic On Page
Robin W
Moderatorthere is a short code in my style pack above that does this as stated above 🙂
December 23, 2020 at 2:39 pm #216917In reply to: First Post of Forum Topic On Page
erich199
ParticipantSorry I might not have explained what I’m trying to accomplish properly.
The shortcode I’m currently using on my live site is this:
[bbp-single-topic id=4657]
Just the normal bbpress shortcode to show the content of the actual topic. I used some CSS code to remove the post form and any replies. So it shows only the first post in a topic which is what I want to display as news on my front page from different forums. The shortcode you listed does show the stickies but just the actual forum topic and not the content of the first post of that forum topic.
I wasn’t sure if there was a shortcode that displays the content of the first post from “x” amount of topics from a specific forum.
So on my page I have three codes that are pulling a single topic from 3 different forums.
December 23, 2020 at 1:00 pm #216916In reply to: First Post of Forum Topic On Page
Robin W
Moderatorbit confused – the shortcode I gave you without the noreply should do what you require
what is the exact shortcode you are using?
December 23, 2020 at 6:03 am #216910In reply to: First Post of Forum Topic On Page
Henry Chinaski
ParticipantI’m interested in this too! Did you find the shortcode?
December 22, 2020 at 3:44 pm #216908In reply to: First Post of Forum Topic On Page
erich199
ParticipantHi @robin-w,
That gets me close to the functionality. I managed to get it displayed properly. You can see at the top of the homepage at tidesofwar.net. I used the single topic shortcode and some css hacks to get it to display how I want it.
The issue is I have to manually edit the page anytime I want the topic to change.
December 22, 2020 at 2:50 pm #216906In reply to: First Post of Forum Topic On Page
Robin W
ModeratorI think my style pack plugin might do what you want
then use
[bsp-display-topic-index show=’1′ forum =’10’ template = ‘short’ show_stickies=’true’ noreply=’true’]
see
dashboard>settings>bbp style pack>shortcodes for how to use
December 22, 2020 at 2:07 pm #216904In reply to: Styling of search results
bolhachefe
ParticipantFirst, put this shortcode on a page: [bbp-search-form].
After, edit the css style of the search form template.
December 22, 2020 at 1:38 pm #216903In reply to: First Post of Forum Topic On Page
erich199
ParticipantThanks for the information. This does accomplish sort of what I want. I don’t want to feed it just a single topic. I would like it to post the two most recent topics in a specific forum. Perhaps I can hunt for this shortcode code and modify it.
December 22, 2020 at 10:33 am #216900In reply to: First Post of Forum Topic On Page
bolhachefe
Participant[bbp-single-topic id=$topic_id]
More information at: https://codex.bbpress.org/features/shortcodes/#topics
December 21, 2020 at 3:46 pm #216882Topic: First Post of Forum Topic On Page
in forum Pluginserich199
ParticipantI was curious if anyone has or knows of any function or shortcode that I can use that pulls the first topic from a specific forum and shows it on a page?
@robin-w , does your bbpress shortcode plugin do this?I basically want to create a section on my homepage called “Announcements” and have the latest two topics from my forums with the Title and an excerpt from the post body included.
December 21, 2020 at 5:18 am #216865In reply to: Display links in the content to members only
Robin W
Moderatorand couldn’t use it in bbPress function’ file.
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
December 21, 2020 at 5:16 am #216864In reply to: Display links in the content to members only
Robin W
Moderatorsorry for late reply.
You would do better to link to topic and reply content
so
add_filter( 'bbp_get_reply_content', 'content_link_for_user_snippets',80, 2 ); add_filter( 'bbp_get_topic_content', 'content_link_for_user_snippets', 80, 2 );
I’d run them at priority 80, as bbpress runs various actions at this point, including one called ‘bbp_make_clickable’ at priority 60, which would probably reverse your efforts !
December 19, 2020 at 7:12 am #216816Topic: Display links in the content to members only
in forum Troubleshootingyt
ParticipantHello
I want a code to use in the function file of bbPress to hide all links in the content of forum’s topics and replies for visitors.
I mean until a visitor is not logged in the forum, instead of displaying links, it shows a text message like “displaying links to members only” and a registration link to register and enter his account so that redirects to the last page in the topic or reply.
Additional Explanation:
I Use the code below:
add_filter( 'the_content', 'content_link_for_user_snippets', 1 ); function content_link_for_user_snippets( $content = '' ) { // Snippets.ir if( ! is_user_logged_in() ) { preg_match_all( "#<a(.*?)>(.*?)#i", $content, $matches ); $num = count( $matches[0] ); for( $i = 0; $i < $num; $i++ ) { $content = str_replace( $matches[0][ $i ], '<a href="' . ( get_permalink() ) . '"><span style="color:#F00;">[displaying links to members only]<span></a>', $content ); } } return $content; }
in My site’s Theme and word very nice but it doesn’t have any effect in form and couldn’t use it in bbPress function’ file.
December 18, 2020 at 5:53 pm #216812In reply to: Add Featured Image to New Topics in Frontend WYSWYG
Robin W
ModeratorYou are asking someone to write code in their free time to do something that their code wasn’t intended to do.
it’s that simple
December 18, 2020 at 2:58 pm #216806In reply to: Error messages are out of sight
Robin W
Moderatorthis is what I might out in style pack
add_action ('bbp_template_before_single_forum' , 'bsp_template_notices') ; add_action ('bbp_template_before_single_topic' , 'bsp_template_notices') ; function bsp_template_notices() { // Bail if no notices or errors if ( ! bbp_has_errors() ) { return; } // Define local variable(s) $errors = $messages = array(); // Get bbPress $bbp = bbpress(); // Loop through notices foreach ( $bbp->errors->get_error_codes() as $code ) { // Get notice severity $severity = $bbp->errors->get_error_data( $code ); // Loop through notices and separate errors from messages foreach ( $bbp->errors->get_error_messages( $code ) as $error ) { if ( 'message' === $severity ) { $messages[] = $error; } else { $errors[] = $error; } } } // Display errors first... if ( ! empty( $errors ) ) : ?> <div class="bbp-template-notice error" role="alert" tabindex="-1"> <ul> <li> <?php echo implode( "</li>\n<li>", $errors ); ?> <a href="#new-post"> <?php _e('Click here to correct', 'bbp-style-pack') ; ?> </a> </li> </ul> </div> <?php endif; }
December 18, 2020 at 2:31 pm #216805In reply to: Error messages are out of sight
Robin W
ModeratorI’ve found that annoying in the past, and not bothered to think about correcting.
This basic code will display the errors at the top, but I might look to improve on that in style pack
add_action ('bbp_template_before_single_forum' , 'bbp_template_notices') ; add_action ('bbp_template_before_single_topic' , 'bbp_template_notices') ;
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
December 18, 2020 at 11:09 am #216794In reply to: apply js file only to the bbp forum
haddlyapis
ParticipantPerfect. Thx Robin!!
The following now works/* only run forum script in forum area */ add_action( 'wp_print_scripts' , 'deregister_forum_script'); function deregister_forum_script(){ if ( !is_bbpress() ){ wp_deregister_script('forum-js'); }}
This ticket is now closed. thx!
December 17, 2020 at 9:03 pm #216787In reply to: add a link to discussion
michaelgoal
ParticipantI have this now, but how do i assigm $kat_id to tthe Blog post category when i submit my Blogpost?
function add_content_before_first_reply_content($content,$id){ $post = get_post($id); $topic_id = bbp_get_topic_id(); $reply_id = bbp_get_reply_id(); $hf_user = wp_get_current_user(); $hf_username = $hf_user->user_login; $kat_id = wp_get_post_parent_id($post); $content_to_add ="<a href="create-new-post?vis=$kat_id> Add new blog </a> if ($topic_id === $reply_id) { // do whatever you need to in here $content .= $content_to_add; } return $content; } add_filter( 'bbp_get_reply_content', '
December 17, 2020 at 4:57 pm #216783In reply to: How to set reply form under the message
zamzey
Participant// Only add onclick if replies are threaded if ( bbp_thread_replies() ) { // Array of classes to pass to moveForm $move_form = array( $r['add_below'] . '-' . $reply->ID, $reply->ID, $r['respond_id'], $reply->post_parent );
i think it somewhere here
December 17, 2020 at 12:18 pm #216777In reply to: developing login re-direct issues
Robin W
Moderatorso what are you using to login – bbpress login widgets, shortcodes or what?
December 15, 2020 at 5:51 pm #216749Topic: Vbulletin to bbpress
in forum Requests & FeedbackDecember 15, 2020 at 6:33 am #216733In reply to: WP database password changed, bbpress error
Robin W
Moderatoralways pays to check how someone did something 🙂
the code that is being called at that point just loads the worpdress access details, so that loaded from wordpress.
I’d suggest a chat with your host provider to see if they know anything in their set up that might have cached an old version.
December 15, 2020 at 2:24 am #216724In reply to: Additional Taxonomies for Posts and Replies
Back to Front
ParticipantOh I found the error in my code above
Just replacing
is_category()
with
is_archive()
Still, not sure I’m taking the best approach here,
maybe I’m missing a simpler way to categorise topics? -
AuthorSearch Results