Skip to:
Content
Pages
Categories
Search
Top
Bottom

Search Results for 'code'

Viewing 25 results - 3,051 through 3,075 (of 32,517 total)
  • Author
    Search Results
  • #209401

    In reply to: Split up my Tags page

    webcreations907
    Participant

    No 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);
    }
    
    
    #209395
    Robin W
    Moderator

    hmmm… 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.php

    transfer 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%/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-archive-forum.php

    bbPress will now use this template instead of the original

    #209390
    Robin W
    Moderator

    put this in the custom css of your theme

    #bbpress-forums #bbp-search-form {
    	display: none !important;
    }
    #209387
    Manuel Camargo
    Participant

    I’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_id

    Not sure what can be hindering my forum behaviour :S

    #209386
    Manuel Camargo
    Participant

    By the way, in my forum template I’m using

    bbp_forum_freshness_link

    #209382
    Robin W
    Moderator

    if you want several change

    'parent_forum' => 'any',

    to

    'post_parent__in' => array( 2, 5, 12, 14, 20 ),

    #209381
    Robin W
    Moderator

    yes, 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

    #209377
    webcreations907
    Participant

    They 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' );
    }
    
    
    #209376

    In reply to: Split up my Tags page

    webcreations907
    Participant

    Hey 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.

    🙂

    #209373
    Robin W
    Moderator

    The 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 );

    #209372
    Robin W
    Moderator

    Put this in your child theme’s function file – or use

    Code Snippets

    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 );
    		}
    }
    #209368
    Robin W
    Moderator

    if you want to improve the code, just add an item to my support page

    https://wordpress.org/support/plugin/bbp-style-pack/

    #209364
    Manuel Camargo
    Participant

    Really 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?

    #209363
    Manuel Camargo
    Participant

    Here you can see it

    images

    I’ve temporarily solve it (or maybe permanently) with:

    .bbp-topic-revision-log-item .bbp-author-avatar {
    	display: none;
    }
    #209358
    Robin W
    Moderator

    just tried it, it is all good, you must have missed a character off somewhere, just add it to the end

    <?php
    function hello_elementor_child_enqueue_scripts() {
    wp_enqueue_style(
    'hello-elementor-child',
    get_stylesheet_directory_uri() . '/style.css',
    [
    'hello-elementor'
    ],
    '1.0.0'
    );
    }
    add_action( 'wp_enqueue_scripts', 'hello_elementor_child_enqueue_scripts' );
    function ele_disable_page_title( $return ) {
    return false;
    }
    add_filter( 'hello_elementor_page_title', 'ele_disable_page_title' );
    add_filter( 'bbp_register_topic_post_type', 'rew') ;
    
    function rew ($rew) {
    
    $rew = array(
    				'labels'              => bbp_get_topic_post_type_labels(),
    				'rewrite'             => bbp_get_topic_post_type_rewrite(),
    				'supports'            => bbp_get_topic_post_type_supports(),
    				'description'         => esc_html__( 'bbPress Topics', 'bbpress' ),
    				'capabilities'        => bbp_get_topic_caps(),
    				'capability_type'     => array( 'topic', 'topics' ),
    				'menu_position'       => 555555,
    				'has_archive'         => ( 'forums' === bbp_show_on_root() ) ? bbp_get_topic_archive_slug() : false,
    				'exclude_from_search' => true,
    				'show_in_nav_menus'   => true,
    				'public'              => true,
    				'show_ui'             => current_user_can( 'bbp_topics_admin' ),
    				'can_export'          => true,
    				'hierarchical'        => false,
    				'query_var'           => true,
    				'menu_icon'           => '',
    				'source'              => 'bbpress',
    			)  ;
    			
    return $rew ;
    }
    
    add_filter( 'bbp_register_reply_post_type', 'rew2') ;
    
    function rew2 ($rew) {
    
    $rew2 = array(
    				'labels'              => bbp_get_reply_post_type_labels(),
    				'rewrite'             => bbp_get_reply_post_type_rewrite(),
    				'supports'            => bbp_get_reply_post_type_supports(),
    				'description'         => esc_html__( 'bbPress Replies', 'bbpress' ),
    				'capabilities'        => bbp_get_reply_caps(),
    				'capability_type'     => array( 'reply', 'replies' ),
    				'menu_position'       => 555555,
    				'exclude_from_search' => true,
    				'has_archive'         => false,
    				'show_in_nav_menus'   => true,
    				'public'              => true,
    				'show_ui'             => current_user_can( 'bbp_replies_admin' ),
    				'can_export'          => true,
    				'hierarchical'        => false,
    				'query_var'           => true,
    				'menu_icon'           => '',
    				'source'              => 'bbpress',
    			)  ;
    			
    return $rew2 ;
    }
    #209350

    In reply to: Split up my Tags page

    webcreations907
    Participant

    I created that example, I just used the categories on your page for the example since the buttons are built based of of those.

    I didn’t do really any styling to it since it’s just a example.

    Link Below
    https://codepen.io/WebCreations907/full/zYGWLRe

    If you like that way that works and want to add it to your site, let me know and can get you some steps on getting that added to your page.

    🙂

    #209335

    In reply to: Freshness is way off

    webcreations907
    Participant

    No problem, glad that’s working out for you so far. 🙂

    You can remove the code when bbpress releases a fix for it, it’s just a temporary solution until it gets worked out.

    #209332

    In reply to: Freshness is way off

    ericsims
    Participant

    Alright, I pasted it in to functions.php, and it seems to be working so far. Thanks so much for sharing! I’ll keep an eye on it over the coming days and hope it keeps working.

    Will I need to remove this code if/when bbPress is updated to incorporate this fix?

    #209304

    In reply to: Freshness is way off

    webcreations907
    Participant

    The below should update the “Topic” page and the main “Forum” page.

    Once you add the code, you’ll have to add a reply to a topic for it to update. Or run the forum repair Robin W mentioned above.

    Add the below code to your functions.php file of your theme (preferably child theme), or use the code snippet plugin.

    
    if(!function_exists('ticket3297_bbpress_update_latest_activity')){
    	function ticket3297_bbpress_update_latest_activity( $reply_id, $topic_id, $forum_id ){
    		
    		$new_time = get_post_field( 'post_date', $reply_id );
    		
    		if ( ! empty( $new_time ) ) {
    			update_post_meta( $forum_id, '_bbp_last_active_time', $new_time );
    		}
    		update_post_meta( $forum_id, '_bbp_last_active_id', $reply_id);
    		update_post_meta( $forum_id, '_bbp_last_reply_id', $reply_id );
    
    		$forum_obj = get_post( $forum_id );
    		if( $forum_obj && $forum_obj->post_parent !== 0 && bbp_is_forum_category( $forum_obj->post_parent ) ){
    		
    			update_post_meta( $forum_obj->post_parent, '_bbp_last_active_id', $reply_id );
    			update_post_meta( $forum_obj->post_parent, '_bbp_last_reply_id', $reply_id );
    			if ( ! empty( $new_time ) ) {
    				update_post_meta( $forum_obj->post_parent, '_bbp_last_active_time', $new_time );
    			}
    		}
    
    	}
    	add_action( 'bbp_new_reply', 'ticket3297_bbpress_update_latest_activity',10,3 );
    }
    
    if(!function_exists('ticket3297_bbpress_delete_update_latest_activity')){
    	function ticket3297_bbpress_delete_update_latest_activity(){
    			$reply_id = bbp_forum_query_last_reply_id();
    			
    			ticket3297_bbpress_update_latest_activity( $reply_id, bbp_get_reply_topic_id( $reply_id ), bbp_get_reply_forum_id( $reply_id ) );
    
    	}
    	add_action('bbp_deleted_reply','ticket3297_bbpress_delete_update_latest_activity');
    	add_action('bbp_trashed_reply','ticket3297_bbpress_delete_update_latest_activity');
    }
    
    

    That should run when replying, deleting, and trashing replies.

    #209301

    In reply to: @mentions

    Robin W
    Moderator

    maybe, I’m tied up in paid work at the moment, so can’t really find time to take a look at the code

    #209270

    Topic: Split up my Tags page

    in forum Themes
    Clivesmith
    Participant

    I have a page that just shows tags https://wateratairports.com/airports-by-iata-code/, it is working great and getting bigger over 300 it could grow to 1000 which is OK on a big screen but on a mobile, not good, I would like to add a line at the top of the tags offering a shortcut ie if you want A-F click this then it will take the user to a page that shows tags stating A and ending with F.

    I am sure I can create the line with links to another page, where I am having a problem is how to only return the tags between A and F.

    The template I am using is

    /**
    * Template Name: bbPress – Topic Tags
    *
    * @package bbPress
    * @subpackage Theme
    */

    get_header(); ?>

    <?php do_action( ‘bbp_before_main_content’ ); ?>

    <?php do_action( ‘bbp_template_notices’ ); ?>

    <?php while ( have_posts() ) : the_post(); ?>

    <div id=”bbp-topic-tags” class=”bbp-topic-tags”>
    <h1 class=”entry-title”><?php the_title(); ?></h1>
    <div class=”entry-content”>

    <?php get_the_content() ? the_content() : _e( ‘<p>This is a collection of tags that are currently popular on our forums.</p>’, ‘bbpress’ ); ?>

    <div id=”bbpress-forums”>

    <?php bbp_breadcrumb(); ?>

    <div id=”bbp-topic-hot-tags”>

    <?php wp_tag_cloud( array( ‘smallest’ => 15, ‘largest’ => 15, ‘number’ => 400, ‘taxonomy’ => bbp_get_topic_tag_tax_id() ) ); ?>

    </div>
    </div>
    </div>
    </div><!– #bbp-topic-tags –>

    <?php endwhile; ?>

    <?php do_action( ‘bbp_after_main_content’ ); ?>

    Is there a way to select what tags are shown ?, I am happy to create more templates.
    hope this makes snese

    #209261
    nabeelpommy
    Participant

    Hello! I am using bbpress and when I type anything in topic and try to apply formatting like bold, italic text, it show the code instead of applied formatting, suppose I applied B for bold it shows <b> Text</b> and does not make text bold , same like other command , like if I try to make text as heading3 its shows <H3> Text </H3> instead of text in Heading 3 style.
    What is problem , thx in advance

    Regards
    Like I use b tag here and my text has bold , but in my case it show command name alognwith text instead of applying that command

    #209238
    Barry
    Participant

    Gotcha!

    Well (and I’m admittedly writing this without ever having worked with GamiPress, but I did just take a quick peek at their code) it certainly seems like something you could do.

    The gamipress_award_points_to_user action (a hook that your code can ‘listen’ for) would let you detect the award of points and you could then examine how many points they have etc and, based on that, take a further step such as changing their forum permissions.

    Definitely seems achievable 🙂

    #209237
    Robin W
    Moderator

    forums etc. are not for the dashboard part of the site for participants.

    create a page and put this code in it

    [bbp-forum-index]

    Then put this page into your site menu

    #209202

    In reply to: Topic Title length

    Chuckie
    Participant

    I suggest you install the plugin Snippets:

    Code Snippets

    Then you can create a snippet and put it there.

Viewing 25 results - 3,051 through 3,075 (of 32,517 total)
Skip to toolbar