• Hi buddyboss, superb plugin by the way but i have a couple of problems, im using another plugin that creates custom post types, now it works fine in the search but the problem i have is with how BuddyPress Global Search shows the post type name in the search.

    let me explain, when i start typing it says loading suggestions and when it finds a custom post type the header for them is “CPT-then name of the custom post type”. So i have a few questions.

    1. is there any chance i can rename the CPT text to something else? because i only want one active custom post type in the search, so i would like to change the text from CPT to say MOVIES and remove the custom post type name from showing after the text CPT, the reason for this is my custom post types are made from another plugin and the custom post type names are named like this “wp_movies” and i cannot change them due to the plugin that created the post type name.

    2. how do i get it to pull the featured image from the custom post type into the search like it does with avatar pictures in members search instead of just text?

    https://www.ads-software.com/plugins/buddypress-global-search/

Viewing 3 replies - 1 through 3 (of 3 total)
    1. They have a filter to change that. Put the following in your theme’s functions.php:-
      add_filter( 'bboss_global_search_label_search_type', 'myprefix_label_search_type' );
      function myprefix_label_search_type( $label ){
      	if( $label=='Cpt-movie' ){
      		$label = 'Movie';
      	}
      	return $label;
      }
    2. create folder buddypress-global-search/loop in your theme. Copy file plugins/buddypress-global-search/templates/loop/post.php to your theme/buddypress-global-search/loop folder. Edit this file and put the_post_thumbnail() etc.. That should work.
    Thread Starter mcpeanut

    (@mcpeanut)

    ckchaudhary ty for this info, the step in part 1. is easy, i have added the code to functions.php into my child theme and have changed the label.

    however im not sure what you mean with part 2. i have done the first steps, ive create the folder buddypress-global-search/loop in my theme and have copied the post.php into the loop folder but the problem is i dont understand this step

    Edit this file and put the_post_thumbnail() etc.. That should work.

    what should i edit? in the post.php there is this code

    <li class="bboss_search_item bboss_search_item_post">
        <h3 class="entry-title">
            <a href="<?php the_permalink(); ?>" title="<?php echo esc_attr( sprintf( __( 'Permalink to %s', 'buddypress-global-search' ), the_title_attribute( 'echo=0' ) ) ); ?>" rel="bookmark"><?php the_title(); ?></a>
        </h3>
    
        <div class="entry-content entry-summary">
    
            <?php the_excerpt(); ?>
    
        </div><!-- .entry-content -->
    </li>

    what do you mean by put the post thumbnail etc? can you give me a quik example? thanxs for all your help btw ??

    Plugin Author BuddyBoss

    (@buddyboss)

    mcpeanut you will need to format the new image but you would actually use this code probably the line after </h3>
    <?php the_post_thumbnail(); ?>
    But you would probably want to encapsulate the thumbnail in it’s own div so you can format it properly so the final code would look like this:

    <div class"search-thumb">
    <?php the_post_thumbnail(); ?>
    </div>

    Then you will need to add CSS for formatting, size, float, padding/margin, etc.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom post types HELP PLEASE’ is closed to new replies.