Search Results for 'code'
-
AuthorSearch Results
-
March 20, 2020 at 1:52 pm #209547
In reply to: Threaded Replies – Still not working
WorldWideWebb
ParticipantOK – implemented a fix that seems to be working (time will tell). Hope this helps someone else:
The issue was indeed the redirect that happens when you click the reply links. The fix was to trap the default behavior of those links (using preventDefault so that the link is not followed), so added that to the link output. In the following file on line 1612:
bbpress/includes/replies/template.php
Change the line to this:
$onclick = ' onclick="event.preventDefault(); return addReply.moveForm(\'' . implode( "','", $move_form ) . '\');"';
March 19, 2020 at 5:15 am #209510In reply to: Create Custom Topic Types
Robin W
ModeratorMarch 18, 2020 at 2:20 pm #209492Topic: TinyMCE will not display on site
in forum TroubleshootingAnnieBVT
ParticipantI have been spending way too much time on trying to change the text editor for bbPress forums. Members should not be expected to know how to use html (which most don’t), and many will post text from other websites into a text box. I don’t understand, after so many updates to the bbPress core and so many questions in your Support forum about it, that this issue has not been resolved.
I added code recommended on the bbPress site in the child theme functions.php for my site, added TinyMCE Advanced, and searched for a checkbox in Forums Settings to enable a fancy editor. That checkbox is not in the list of options on my site. And all I see in the text editor for topic replies is the html buttons. Could someone please help us with fixing this issue. The plugin recommendations on this support forum are from many years ago, and those recommended plugins are out of date, no longer being updated, or cause problems for sites when installed.
I would really appreciate assistance. Thanks.
March 17, 2020 at 7:05 pm #209471Topic: Recent Topics
in forum Troubleshootingiamthewebb
ParticipantHi,
On the front page of this site there is a Recent Topics box that only shows 5 topics, how do I replicate this on my own site? I can only see a shortcode that displays 15.
Thanks
March 17, 2020 at 12:28 pm #209469In reply to: Automatic Archive Settings for Topics
Robin W
Moderatorno need to change them – they are only names, although you could change
add_action('bbpress_daily_event', 'bbpress_close_old_topics');
to
add_action('bbpress_daily_event', 'bbpress_delete_old_topics');
and
function bbpress_close_old_topics() { // Auto close old topics
to
function bbpress_delete_old_topics() { // Auto delete old topics
which would just make it clearer what it was doing – but not necessary !!
March 17, 2020 at 12:14 pm #209468In reply to: Automatic Archive Settings for Topics
writersabroad
ParticipantRobin, sorry another quick question do I have to replace all references to ‘close’ with ‘delete instead in the other sections of the code? e.g in this one
add_action(‘bbpress_daily_event’, ‘bbpress_close_old_topics’)
Thanks… sorry I’m not more up on this kind of thing…
March 16, 2020 at 6:10 pm #209437boomer48
ParticipantThanks for the tips. I did the right click and it clearly showed the #ccc color code. I didn’t realize that this was loading from the browser cache. I’m used to programming microcontrollers, not websites. Cleared the browser cache on all my web browsers and now the closed link stays black.
March 16, 2020 at 12:58 pm #209431Robin W
ModeratorNot sure what you would see other than a grayed out post.
lots of front end tools we can use to see what is happening, which we can’t with pictures.
My real question is why manually editing the color code in the CSS files doesnโt have any effect.
could be loads of things, including caching as Chuckie says, theme and child theme issue or other things.
March 16, 2020 at 12:29 pm #209429In reply to: Automatic Archive Settings for Topics
writersabroad
ParticipantThanks, Robin. One last question ๐ If I want it to delete topics I presume I change the code
bbp_close_topic( $topic_id );
to
bbp_delete_topic( $topic_id );
A lot of the posts I want to get rid of have images so trying to clean up and free space… thanks again!
March 16, 2020 at 11:51 am #209428In reply to: Help with bbPress Topics for Posts addon plugin
Stephen Ekpa
ParticipantWow…Thanks for these code.
I tested it on my test site with newmag wordpress theme by tagdiv and it worked.
But on the main site, I’m using Jnews Child theme. I tried it, but it did not work. Perhaps it because I don’t know which function.php to use; main theme or child theme funtion. Tried with child theme, but it did not work.March 16, 2020 at 11:04 am #209423boomer48
ParticipantIt’s a private website for our HOA so I would need to change it to public to make the link work. Not sure what you would see other than a grayed out post. The settings for the post are “Super Sticky” and “Closed”. Simple plain text.
My real question is why manually editing the color code in the CSS files doesn’t have any effect. I have deleted the forum, deactivated bbpress, activated bbpress, and created a new forum. Shouldn’t that pick up the changed CSS files? My host is Bluehost if that makes any difference.
March 15, 2020 at 3:01 pm #209401In reply to: Split up my Tags page
webcreations907
ParticipantNo problem, glad that worked out for you.
I was trying to update the code in the above to remove the inline styles and !important, but guess I can’t edit replies on here.
Will provide update code below, if you want to update it.
CSS
.airport-iata-info{ padding-left:15px; color:rgba(0,0,0,0.6); font-weight:bolder; font-size:14px; margin-top:20px; } .airport-iata-filter-tag-wrap span.active, .airport-iata-filter-tag-wrap span:hover{ background-color:#087cc1; color:#fff; } .airport-iata-filter-tag-wrap{ border:1px solid rgba(0,0,0,0.1);; display:table; padding:0 10px 10px; border-radius:4px; margin-bottom:10px } .airport-iata-filter-tag-wrap span{ cursor:pointer; background-color:#fff; box-shadow:0 2px 5px rgba(0,0,0,0.2); margin:10px; border-radius:4px; padding:10px 20px; display:inline-block; }
functions.php file
if(!function_exists('airport_iata_code_filter_buttons')){ function airport_iata_code_filter_buttons(){ if(!function_exists('is_page')) return; if(is_page(4760)){ ?> <script> (function($){ var buttons= {}; buttons['a-f'] = 'a b c d e f'; buttons['g-l'] = 'g h i j k l'; buttons['m-s'] = 'm n o p q r s'; buttons['t-z'] = 't u v w x y z'; var get_tag_class = function( tag ){ var tag_class = false; $.each(buttons,function(index,el){ if(el.indexOf(tag.toLowerCase()) > -1){ tag_class = index; return false; } }); return tag_class; } $('#bbp-topic-hot-tags .tag-cloud-link').each(function(){ var tag_class = get_tag_class($(this).text().slice(0,1)); if(tag_class !== false){ $(this).addClass('airport-iata-filter-tag-cloud-'+tag_class).attr('data-airport-iata-tag',tag_class); } }); $('#bbp-topic-hot-tags').prepend('<div class="airport-iata-filter-tag-wrap"><div class="airport-iata-info">Filter IATA Codes</div></div>'); $('.airport-iata-filter-tag-wrap').append('<span class="airport-iata-filter-all active">All</span>'); $.each(buttons,function(index,el){ $('.airport-iata-filter-tag-wrap').append('<span data-airport-iata-filter-key="'+index+'" class="airport-iata-filter-tag-cloud-'+index+'">'+index.toUpperCase()+'</span>'); }); $(document).on('click', '.airport-iata-filter-tag-wrap span', function(e){ e.preventDefault(); $('.airport-iata-filter-tag-wrap span').removeClass('active'); $(this).addClass('active'); if($(this).hasClass('airport-iata-filter-all')){ $('#bbp-topic-hot-tags a.tag-cloud-link').show(); }else{ $('#bbp-topic-hot-tags a.tag-cloud-link').hide(); $('#bbp-topic-hot-tags a.tag-cloud-link.airport-iata-filter-tag-cloud-'+$(this).attr('data-airport-iata-filter-key')).show(); } }); })(jQuery); </script> <?php } } add_action( 'wp_footer', 'airport_iata_code_filter_buttons', 100); }
March 15, 2020 at 1:20 pm #209395In reply to: bbPress 2.6.4 Remove Default Search Bar
Robin W
Moderatorhmmm… css won’t do it then.
you’ll need to amend content-archive-forum.php in your child theme
find
wp-content/plugins/bbpress/templates/default/bbpress/content-archive-forum.phptransfer this to your pc and edit
delete line 17
<?php bbp_get_template_part( 'form', 'search' ); ?>
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-archive-forum.phpbbPress will now use this template instead of the original
March 15, 2020 at 12:16 pm #209390In reply to: bbPress 2.6.4 Remove Default Search Bar
Robin W
Moderatorput this in the custom css of your theme
#bbpress-forums #bbp-search-form { display: none !important; }
March 15, 2020 at 11:38 am #209387SirLouen
ParticipantI’ve checked the bbpress code and it seems that something is hindering my site
Theorically it shall show the last replay by default without the need of a plugin because it technically should be saving the last active id in the forum post meta field _bbp_last_active_idNot sure what can be hindering my forum behaviour :S
March 15, 2020 at 11:29 am #209386SirLouen
ParticipantBy the way, in my forum template I’m using
bbp_forum_freshness_link
March 15, 2020 at 7:35 am #209382In reply to: Automatic Archive Settings for Topics
Robin W
Moderatorif you want several change
'parent_forum' => 'any',
to
'post_parent__in' => array( 2, 5, 12, 14, 20 ),
March 15, 2020 at 7:22 am #209381In reply to: Automatic Archive Settings for Topics
Robin W
Moderatoryes, just change the line
'parent_forum' => 'any',
to
'parent_forum' => '123456',
you can find a forums number by looking at the url whilst you are editing it
dashboard>forums>all forums>edit (the forum you want) and in the url bar you will see
http://www.mysite.com/wp-admin/post.php?post=28109&action=edit
March 14, 2020 at 10:53 pm #209377In reply to: Help with bbPress Topics for Posts addon plugin
webcreations907
ParticipantThey may have quit working on it.
I did some digging through their code, and came up with something for you to try if you want.
You’ll add the below code to your theme’s
functions.php
file, once you add the code and save the file. Reload your WordPress admin area by refreshing the page/browser, then remove the code and re-save the file.Go to your discussions page, and try out that button(Apply settings to existing posts) again and see if it works for you.
if(!function_exists('bbppt_reset_topics_for_posts_meta_fix')){ function bbppt_reset_topics_for_posts_meta_fix(){ $args = array( 'meta_key' => 'bbpress_discussion_comments_copied', 'post_type' => 'post', 'post_status' => 'any', 'posts_per_page' => -1 ); $posts = get_posts($args); if($posts){ foreach ($posts as $post) { delete_post_meta( $post->ID, 'bbpress_discussion_topic_id'); delete_post_meta( $post->ID, 'bbpress_discussion_comments_copied'); $comments = get_comments( array( 'post_id' => $post->ID, 'order' => 'ASC' ) ); if($comments){ foreach ($comments as $comment) { delete_comment_meta( $comment->comment_ID, 'bbppt_imported'); } } } } } add_action( 'admin_init', 'bbppt_reset_topics_for_posts_meta_fix' ); }
March 14, 2020 at 7:03 pm #209376In reply to: Split up my Tags page
webcreations907
ParticipantHey there,
I got that code for you so you can add it to your page and give it a try.
Put the code below in your
style.css
file of your theme, you can change as needed. It only styles the filter buttons..airport-iata-info{ padding-left:15px; color:rgba(0,0,0,0.6); font-weight:bolder; font-size:14px; margin-top:20px; } .airport-iata-filter-tag-wrap span.active, .airport-iata-filter-tag-wrap span:hover{ background-color:#087cc1; color:#fff; } .airport-iata-filter-tag-wrap{ border:1px solid rgba(0,0,0,0.1);; display:table; padding:0 10px 10px; border-radius:4px; } .airport-iata-filter-tag-wrap span{ background-color:#fff; box-shadow:0 2px 5px rgba(0,0,0,0.2); margin:10px; border-radius:4px; padding:10px 20px !important; display:inline-block; }
This code below you’ll need to put in your
functions.php
file of your theme, best if you put in child theme so that you don’t have to replace when you update your theme in the future. The function below is only set to run on that page you have the listed tags on.if(!function_exists('airport_iata_code_filter_buttons')){ function airport_iata_code_filter_buttons(){ if(!function_exists('is_page')) return; if(is_page(4760)){ ?> <script> (function($){ var buttons= {}; buttons['a-f'] = 'a b c d e f'; buttons['g-l'] = 'g h i j k l'; buttons['m-s'] = 'm n o p q r s'; buttons['t-z'] = 't u v w x y z'; var get_tag_class = function( tag ){ var tag_class = false; $.each(buttons,function(index,el){ if(el.indexOf(tag.toLowerCase()) > -1){ tag_class = index; return false; } }); return tag_class; } $('#bbp-topic-hot-tags .tag-cloud-link').each(function(){ var tag_class = get_tag_class($(this).text().slice(0,1)); if(tag_class !== false){ $(this).addClass('airport-iata-filter-tag-cloud-'+tag_class).attr('data-airport-iata-tag',tag_class); } }); $('#bbp-topic-hot-tags').prepend('<div class="airport-iata-filter-tag-wrap" style="margin-bottom:20px;"><div class="airport-iata-info">Filter IATA Codes</div></div>'); $('.airport-iata-filter-tag-wrap').append('<span style="cursor:pointer;padding:10px;" class="airport-iata-filter-all active">All</span>'); $.each(buttons,function(index,el){ $('.airport-iata-filter-tag-wrap').append('<span data-airport-iata-filter-key="'+index+'" style="cursor:pointer;padding:10px;" class="airport-iata-filter-tag-cloud-'+index+'">'+index.toUpperCase()+'</span>'); }); $(document).on('click', '.airport-iata-filter-tag-wrap span', function(e){ e.preventDefault(); $('.airport-iata-filter-tag-wrap span').removeClass('active'); $(this).addClass('active'); if($(this).hasClass('airport-iata-filter-all')){ $('#bbp-topic-hot-tags a.tag-cloud-link').show(); }else{ $('#bbp-topic-hot-tags a.tag-cloud-link').hide(); $('#bbp-topic-hot-tags a.tag-cloud-link.airport-iata-filter-tag-cloud-'+$(this).attr('data-airport-iata-filter-key')).show(); } }); })(jQuery); </script> <?php } } add_action( 'wp_footer', 'airport_iata_code_filter_buttons', 100); }
That’s it, should work. Let me know if you have any issues or questions on any of that.
๐
March 14, 2020 at 11:53 am #209373In reply to: Automatic Archive Settings for Topics
Robin W
ModeratorThe above will ‘close’ the topic, if you want it archived, then in effect you will need to trash it, this just puts it in the trash, so it can be recovered
to do this replace
bbp_close_topic( $topic_id );
with
bbp_trash_topic( $topic_id );
March 14, 2020 at 11:51 am #209372In reply to: Automatic Archive Settings for Topics
Robin W
ModeratorPut this in your child theme’s function file – or use
change the ‘-10 days’ to say ‘-90 days’ if you want 3 months
register_activation_hook(__FILE__, 'bbpress_topic_scheduler'); add_action('bbpress_daily_event', 'bbpress_close_old_topics'); function bbpress_topic_scheduler() { wp_schedule_event(time(), 'daily', 'bbpress_daily_event'); } function bbpress_close_old_topics() { // Auto close old topics $topics_query = array( 'author' => 0, 'show_stickies' => false, 'parent_forum' => 'any', 'post_status' => 'publish', 'posts_per_page' => -1 ); if ( bbp_has_topics( $topics_query ) ) while( bbp_topics() ) { bbp_the_topic(); $topic_id = bbp_get_topic_id(); $last_active = strtotime( get_post_meta( $topic_id, '_bbp_last_active_time', true ) ); if ($last_active < strtotime( '-10 days') ) bbp_close_topic( $topic_id ); } }
March 14, 2020 at 7:35 am #209368Robin W
Moderatorif you want to improve the code, just add an item to my support page
March 14, 2020 at 7:17 am #209364SirLouen
ParticipantReally interesting plugin
I did not even modify the Freshness Display and it switched to last reply by default.I’m going to help you out with the translation to Spanish of that plugin.
By the way, for code improvements, how do you track changes? do you have public repo for the plugin or using WP SVN?
March 14, 2020 at 7:01 am #209363In reply to: Remove users icon from revision
SirLouen
ParticipantHere you can see it
I’ve temporarily solve it (or maybe permanently) with:
.bbp-topic-revision-log-item .bbp-author-avatar { display: none; }
-
AuthorSearch Results