Search Results for 'code'
-
AuthorSearch Results
-
December 18, 2014 at 2:22 pm #155788
Robkk
Moderatorwell really your suppose to put bbPress plugin CSS in a folder called CSS in your child theme in a file called bbpress.css , more info here
https://codex.bbpress.org/theme-compatibility/
but adding the code to your child themes css file is fine
jetpack’s custom css module is fine too.to remove the footer completely
remove all this code in the file.
<li class="bbp-footer"> <div class="tr"> <p class="td colspan4"> </p> </div><!-- .tr --> </li><!-- .bbp-footer -->December 18, 2014 at 2:16 pm #155787j0n4h
Participant@skisma Actually, unrelated, but would you mind telling me where the line of code is located to change “freshness”? I know there’s that plugin, but it seems excessive to use it to change one thing.
December 18, 2014 at 2:12 pm #155786Topic: What are shortcodes? How do I use them?
in forum PluginsSkisma
ParticipantSorry to ask such a silly question, but I cannot seem to find info on them other than the http://codex.bbpress.org/shortcodes/ page. I have an idea of what they are, I’m just not sure how exactly to use them. It explains on that page that I just insert them into my desired page, but does not elaborate on that. I was hoping to find an article somewhere that goes over them in detail, but have yet to find it. So, I’ve decided to make a noob post here the bbpress forums.
December 18, 2014 at 2:01 pm #155783Robkk
Moderatorits no problem with the file
its just that the footer is a different color than it should be
this should make it look better
#bbpress-forums li.bbp-footer { background: #383838; border-top: none; font-weight: bold; padding: 8px; text-align: center; }December 18, 2014 at 1:27 pm #155781Skisma
ParticipantAre you talking about the spacing between each group of forums? If so, this is how the code is written and it is part of the desired layout. I just recently used this same code and my forums look great! You can compare to yours and see if there’s a difference?
December 18, 2014 at 12:39 pm #155773Topic: How to show list foruns in homepage without shortcode
in forum ThemesAngelo Rocha
ParticipantI need create a query to bring the list of forums and subforums on the homepage of my website, i woudn’t like to use shortcodes cuz i want create a custom style. I did a wp-query but i can’t use functions to show the topic, replies and posts quantity.
<?php $args = array( 'post_type' => 'forum', 'order' => 'DESC', 'orderby' => 'date' ); $query = new WP_Query($args); ?> Foruns| Posts <?php if( $query -> have_posts() ): ?> <?php while ($query -> have_posts() ) : $query -> the_post(); ?> <a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"> <?php the_title(); ?> </a> <?php $value = bbp_get_forum_post_count(); echo $value; ?> <?php endwhile; ?> <?php wp_reset_postdata(); ?> <?php else: ?> Nothing yet... <?php endif; ?>Thanks for help.
December 18, 2014 at 12:38 pm #155772In reply to: bbPress in wordpress search results
Robkk
Moderatoradd this to functions.php in your child theme
/** * Include bbPress 'topic' custom post type in WordPress' search results */ function ntwb_bbp_topic_cpt_search( $topic_search ) { $topic_search['exclude_from_search'] = false; return $topic_search; } add_filter( 'bbp_register_topic_post_type', 'ntwb_bbp_topic_cpt_search' ); /** * Include bbPress 'reply' custom post type in WordPress' search results */ function ntwb_bbp_reply_cpt_search( $reply_search ) { $reply_search['exclude_from_search'] = false; return $reply_search; } add_filter( 'bbp_register_reply_post_type', 'ntwb_bbp_reply_cpt_search' );got the code from here
December 18, 2014 at 12:01 pm #155768Topic: bbPress in wordpress search results
in forum TroubleshootingAngelo Rocha
ParticipantHi!
How to make the bbpress content show in wordpress search? I create a custom search:<div class="col-md-8 col-md-offset-4 searchform-top" id="searchform-top"> <form class="input-group" role="search" method="get" id="searchform" action="<?php echo home_url( '/' ); ?>"> <input class="form-control input-block" id="appendedInputButton" type="text" placeholder="Buscar no site" name="s" id="s"> <span class="input-group-btn"> <button class="btn btn-primary" type="submit" id="searchsubmit">Buscar</button> </span> </form> </div>But bbpress results not appear when i search it.
December 18, 2014 at 10:34 am #155764In reply to: Remove Separator
Robin W
Moderatornever write code whilst your other half is waiting to go out !
ok, this works
function remove_sep ($args) { $args['before'] = '' ; return $args ; } add_filter ('bbp_before_get_forum_subscribe_link_parse_args', 'remove_sep') ;On your larger point, there are a lot of resources, but it takes a lot of practice to get good at PHP, and to understand how any plugin works which is the size that bbpress is.
Generally it is quicker to ask a question on here, than spend hours delving into bbpress. But if you start wanting to really tailor it, then the step by step guides and other documentation will try and get you into how to go about finding code within bbpress.
I know nothing of php 18months ago (I’m just a humble bbpress user – I didn’t write any of it!), and now have several plugins for bbpress to add functionality, so it is quire do-able.
I’ve tried to get much of my learning into the documentation, so have a look round
December 18, 2014 at 10:28 am #155762In reply to: Sub forums in bbpress 2.3 and buddypress 1.7
derricksmith01
ParticipantHello,
I really needed this feature so I dug into the code and came up with a solution that doesn’t modify core files. The solution hooks the query pre_get_posts and uses the buddypress ‘plugins’ template file to catch and display the group sub forums.
This probably isn’t the most efficient solution but it seems to work in my environment. I’ll post back if I notice any issues as more subforums are created.
Here are the functions – place in your theme’s functions.php. I also included my plugins.php file also.
// functions.php
//Filters bbpress forum permalink if on a group forum page. Keeps users from being redirected to sitewide forums function buddyboss_forum_permalink($link){ global $wpdb, $bp; if (strpos($link, "/forums/forum/")){ $forum = substr($link, strpos($link, "/forum/") + 7); $forums = explode("/",$forum); $args=array( 'post_type' => 'forum', 'name' => $forums[0], ); $root_forum = get_posts( $args ); $group_id = $wpdb->get_var( " SELECT group_id FROM wp_bp_groups_groupmeta WHERE meta_key = 'forum_id' AND meta_value = '". serialize(array($root_forum[0]->ID)) ."'" ); if (isset($group_id)){ $group = groups_get_group( array( 'group_id' => $group_id ) ); unset($forums[0]); $forums = implode("/",$forums); $permalink = bp_get_group_forum_permalink($group)."/".$forums; } else { $permalink = $link; } } return $permalink; } add_filter('bbp_get_forum_permalink','buddyboss_forum_permalink',10,1); //Filters bbpress topic permalink if on a group forum page. Keeps users from being redirected to sitewide forums function buddyboss_topic_permalink($link){ global $wpdb, $bp; if (strpos($link, "/forums/topic/")){ $start_topic = substr($link, strpos($link, "/topic/") + 7); $args=array( 'post_type' => 'topic', 'name' => $start_topic, ); $topic = get_posts( $args ); $topic_forums = get_post_ancestors( $topic[0]->ID ); $root_forum_id = end($topic_forums); $group_id = $wpdb->get_var( " SELECT group_id FROM wp_bp_groups_groupmeta WHERE meta_key = 'forum_id' AND meta_value = '". serialize(array($root_forum_id)) ."'" ); if (isset($group_id)){ $group = groups_get_group( array( 'group_id' => $group_id ) ); array_pop($topic_forums); //Pop group's root forum foreach ($topic_forums as $forum){ $post = get_post($forum); $slug = $post->post_name; $forum_parts .= $slug."/"; } $permalink = bp_get_group_forum_permalink($group)."/".$forum_parts."topic/".$start_topic; } else { $permalink = $link; } } return $permalink; } add_filter('bbp_get_topic_permalink','buddyboss_topic_permalink',10,1); //Filters bbpress reply permalink if on a group forum page. Keeps users from being redirected to sitewide forums function buddyboss_reply_permalink($link){ if (strpos($link, "/forums/reply/")){ $reply = str_replace(site_url()."/forums/reply/","reply/",$link); $forum = str_replace("/forums/forum/".$bp->groups->current_group->slug, "/groups/".$bp->groups->current_group->slug ."/forum", bbp_get_topic_permalink(bbp_get_topic_id())); $permalink = $forum.$reply; } return $link; } add_filter('bbp_get_reply_permalink','buddyboss_reply_permalink',10,1); function buddyboss_bbpress_pre_get_posts($query){ global $bp; if( $query->is_main_query()) { if (bp_current_action() == 'forum'){ if (!empty($bp->action_variables) && !in_array("topic", $bp->action_variables) && !in_array("reply", $bp->action_variables)){ //Sub Forum $forum = end($bp->action_variables); $args = array( 'post_type' => 'forum', 'name' => $forum ); $forums = get_posts( $args ); $parent = $query->get('p'); $query->set('p',''); $query->set('post_parent',$parent); bbpress()->current_forum_id = $forums[0]->ID; bbp_set_query_name( 'bbp_single_forum' ); return $query; } if (empty($bp->action_variables) ) { //Root Group Forum bbp_set_query_name( 'bbp_single_forum' ); return $query; } if (in_array("topic", $bp->action_variables) && !in_array("reply", $bp->action_variables)){ //Topic $topic = end($bp->action_variables); if ($topic == 'edit'){ $edit_key == array_search($topic,$bp->action_variables); $topic = $bp->action_variables[$edit_key-1]; } $args = array( 'post_type' => 'topic', 'name' => $topic ); $topics = get_posts( $args ); $query->set('p',''); $query->set('post_parent',$topics[0]->post_parent); bbpress()->current_forum_id = $topics[0]->post_parent; bbpress()->current_topic_id = $topics[0]->ID; bbp_set_query_name( 'bbp_single_topic' ); if (end($bp->action_variables) == 'edit'){ bbpress()->current_view_id = 'edit'; } return $query; } if (in_array("topic", $bp->action_variables) && in_array("reply", $bp->action_variables)){ //Reply $reply = array_search('reply', $bp->action_variables); $reply_id = $bp->action_variables[$reply+1]; $reply_post = get_post( $reply_id ); $query->set('p',$reply_id); bbpress()->current_topic_id = $reply_post->post_parent; bbpress()->current_reply_id = $reply_id; bbp_set_query_name( 'bbp_single_reply' ); if (end($bp->action_variables) == 'edit'){ bbpress()->current_view_id = 'edit'; } return $query; } } } return $query; } add_action('pre_get_posts','buddyboss_bbpress_pre_get_posts',10, 1); function buddyboss_bbpress_is_edit($retval){ global $bp; if (end($bp->action_variables) == 'edit') $retval = true; return $retval; } add_filter('bbp_is_topic_edit','buddyboss_bbpress_is_edit', 10, 1); add_filter('bbp_is_reply_edit','buddyboss_bbpress_is_edit', 10, 1); function buddyboss_bbpress_form_reply_content($retval){ global $bp; if (end($bp->action_variables) == 'edit' && in_array('topic', $bp->action_variables) && in_array('reply', $bp->action_variables)) { $post = get_post( bbpress()->current_reply_id ); return esc_textarea( $post->post_content ); } } add_filter('bbp_get_form_reply_content','buddyboss_bbpress_form_reply_content', 10, 1); function buddyboss_bbpress_form_topic_content($retval){ global $bp; if (end($bp->action_variables) == 'edit' && in_array('topic', $bp->action_variables) && !in_array('reply', $bp->action_variables)) { $post = get_post( bbpress()->current_topic_id ); return esc_textarea( $post->post_content ); } } add_filter('bbp_get_form_topic_content','buddyboss_bbpress_form_topic_content', 10, 1); function buddyboss_bbpress_form_title(){ global $bp; if (end($bp->action_variables) == 'edit' && in_array('topic', $bp->action_variables) && !in_array('reply', $bp->action_variables)) { $post = get_post( bbpress()->current_topic_id ); return esc_html( $post->post_title ); } } add_filter('bbp_get_form_topic_title','buddyboss_bbpress_form_title', 10, 1); //Filters bbpress admin links if on a group forum page. Keeps users from being redirected to sitewide forums function buddyboss_reply_admin_links( $links, $args ) { global $bp; if (bp_current_action() == 'forum'){ $dom = new DOMDocument; $dom->loadHTML($links); foreach ($dom->getElementsByTagName('a') as $node) { //print_r($node); if ($node->nodeValue == 'Edit'){ $forum = str_replace("/forums/forum/".$bp->groups->current_group->slug, "/groups/".$bp->groups->current_group->slug ."/forum", bbp_get_topic_permalink(bbp_get_topic_id())); $reply = str_replace(site_url()."/forums/reply/","reply/",$node->getAttribute( 'href' )); $node->setAttribute('href', $forum.$reply); } } $links = $dom->saveHTML(); } return $links; } add_filter( 'bbp_get_reply_admin_links', 'buddyboss_reply_admin_links', 10, 2 );/buddypress/groups/single/plugins.php
<?php global $bp; do_action( 'bp_before_group_plugin_template' ); if (bp_current_action() == 'forum'){ if (empty($bp->action_variables)){ //Forum $bp->groups->current_group->id; $group_forum = groups_get_groupmeta( $bp->groups->current_group->id, $meta_key = 'forum_id'); $group_forum_id = $group_forum[0]; bbpress()->current_forum_id = $group_forum_id; bbp_get_template_part('content','single-forum'); } elseif (!empty($bp->action_variables) && !in_array("topic", $bp->action_variables) && !in_array("reply", $bp->action_variables)){ bbp_get_template_part('content','single-forum'); } elseif (in_array("topic", $bp->action_variables) && !in_array("reply", $bp->action_variables)){ //Topic if (bbpress()->current_view_id === 'edit'){ echo "<div id='bbpress-forums'>"; echo "<a href='".bbp_get_topic_permalink()."'><h4><img src='".get_stylesheet_directory_uri()."/images/back_button.png' />Back to Topic</h4></a>"; bbp_get_template_part('form','topic'); echo "</div>"; } else { bbp_get_template_part('content','single-topic'); } } elseif (in_array("topic", $bp->action_variables) && in_array("reply", $bp->action_variables)){ //Reply if (bbpress()->current_view_id === 'edit'){ echo "<div id='bbpress-forums'>"; echo "<a href='".bbp_get_topic_permalink()."'><h4><img src='".get_stylesheet_directory_uri()."/images/back_button.png' /> Back to Topic</h4></a>"; bbp_get_template_part('form','reply'); echo "</div>"; } else { bbp_get_template_part('content','single-reply'); } } } else { do_action( 'bp_template_content' ); } ?> <?php do_action( 'bp_after_group_plugin_template' );December 18, 2014 at 10:16 am #155761Robkk
Moderatoryou can place this code into your child themes functions.php file
/** * Include bbPress 'topic' custom post type in WordPress' search results */ function ntwb_bbp_topic_cpt_search( $topic_search ) { $topic_search['exclude_from_search'] = false; return $topic_search; } add_filter( 'bbp_register_topic_post_type', 'ntwb_bbp_topic_cpt_search' ); /** * Include bbPress 'reply' custom post type in WordPress' search results */ function ntwb_bbp_reply_cpt_search( $reply_search ) { $reply_search['exclude_from_search'] = false; return $reply_search; } add_filter( 'bbp_register_reply_post_type', 'ntwb_bbp_reply_cpt_search' );got the code from here, i see you also commented on it to š
December 18, 2014 at 10:05 am #155760In reply to: Page Not Found Error
Robkk
Moderatorwhy didnt you use the phpbb to bbPress importer in the bbPress plugin.
December 18, 2014 at 9:54 am #155757In reply to: Remove Separator
MaxLiao
ParticipantFirst of all, thank you for the response. I really appreciate your help.
Unfortunately, that code did not work; the separator is still there. You indicated that was a possibility, so no worries.
Since this doesn’t seem like a matter of just finding a | in some code and removing it or adding a
display:none;to the CSS to remove it, is there a resource that would better help me understand how this is being accomplished? I would hate to have to ask this same question every time I want to add or remove a separator. My PHP skills exist but they are weak. Anything to help strengthen them in this regard would be fantastic.December 18, 2014 at 8:30 am #155754Robkk
Moderatorif you were here Iād give you a big kiss.
uhhhhhhhhhhhhhh , your welcome i guess?? haha
about it not being updated in over a year , the plugin is very simple it basically just outputs a shortcode at the bottom of blog posts.
and also that this functionality is going to be implemented in the future release of bbPress.
so when the update comes and says bbPress for WordPress comments in the changelog of the plguin. you can pretty much just remove the topics for posts plugin from there on and just use bbPress.
December 18, 2014 at 8:21 am #155752In reply to: resize bbpress forum
Robkk
Moderatoradd this anywhere you can add custom css and see if this works
.bbpress .container { max-width:100%; }if it doesnt try this also
.bbpress .container { max-width:100% !important; }December 18, 2014 at 8:15 am #155751Robkk
Moderatoryeah you shouldnt edit the core files.
i see there is additional quotation marks in your code maybe replacing it with this will help.
<span class="bbp-topic-started-by"><?php printf( __( 'Started by: %1$s', 'bbpress' ), bbp_get_topic_author_link( array( 'size' => '90' ) ) ); ?></span>December 18, 2014 at 7:32 am #155744In reply to: Change the color of individual role names
Robkk
Moderatorthis topic is for changing the role names background color.
like for example this site has them with a gray background
if i use the code snippet above i can have blue for participants , red for keymasters , and yellow for moderators and so on for each role just by applying a little CSS.
make a new topic and ill check out doing that in the next few days when i setup my custom cpu up all right with a local dev area and not use linux anymore.
December 18, 2014 at 7:22 am #155743Robkk
Moderator@skisma i think that was just a mockup from this website in the link below
and the author of this topic just stumbled upon it.
and since this is from 2009 it is most likely the bbpress standalone version 1.0x and such
but you could accomplish close to the same result using wp-usersonline plugin and also the inbuilt stats shortcode and just a little bit of CSS.
create a new topic about this though.
December 18, 2014 at 7:13 am #155742In reply to: Remove "This post was modified…"
Robkk
Moderatoruntick topic/reply edit logging in settings>forums to disable the logging of future posts.
and add this CSS anywhere you can add custom CSS to hide the edit logs on any existing posts.
#bbpress-forums .bbp-topic-content ul.bbp-topic-revision-log, #bbpress-forums .bbp-reply-content ul.bbp-topic-revision-log, #bbpress-forums .bbp-reply-content ul.bbp-reply-revision-log { display: none; }December 18, 2014 at 4:20 am #155730In reply to: Remove Separator
Robin W
Moderatorquick reply as I’m on my way out, so untested, but put the following in your functions file
function remove_sep ($args) { $args['before' ] = '' ; Return $args ; } add_filter ('bbp_before_get_topic_subscription_link_parse_args', 'remove_sep') ;If it doesn’t work, come back and I’ll do it properly and test it for you !
December 18, 2014 at 3:54 am #155727In reply to: I need simple breadcrumb
December 17, 2014 at 12:42 pm #155710In reply to: I need my subtopic to have line-brakes
December 17, 2014 at 12:41 pm #155709In reply to: I need simple breadcrumb
December 17, 2014 at 11:33 am #155701In reply to: My language files are overwritten by update
robertosalemi
ParticipantHi,
I try this code
add_filter( 'auto_update_translation', '__return_false' );but this code not works, today my language files are overwritten.
Why?
Thanks.
December 17, 2014 at 10:25 am #155696AlexandruIoan
ParticipantTry to use a plugin, search for ” statistics plugin or who’s online plugin ” or use this new short code : [bbp-statistics] .
You welcome! -
AuthorSearch Results