Need BuddyPress Global Search to Recognize Courses from CoursePress Pro

Hello, how can I get BuddyPress Global Search to recognize courses from CoursePress Pro? It doesn't come up in the list of items to search.

  • Luís

    Hi @Christina,

    I hope had been good today!

    Copy the code below and paste in your theme functions.php, found in /public_html/wp-content/themes/your-theme folder.

    function register_custom_posts() {
    
    	$args = array(
    
    		'labels'              => array(
    
    			'name'               => __( 'Courses', 'cp' ),
    
    			'singular_name'      => __( 'Course', 'cp' ),
    
    			'add_new'            => __( 'Create New', 'cp' ),
    
    			'add_new_item'       => __( 'Create New Course', 'cp' ),
    
    			'edit_item'          => __( 'Edit Course', 'cp' ),
    
    			'edit'               => __( 'Edit', 'cp' ),
    
    			'new_item'           => __( 'New Course', 'cp' ),
    
    			'view_item'          => __( 'View Course', 'cp' ),
    
    			'search_items'       => __( 'Search Courses', 'cp' ),
    
    			'not_found'          => __( 'No Courses Found', 'cp' ),
    
    			'not_found_in_trash' => __( 'No Courses found in Trash', 'cp' ),
    
    			'view'               => __( 'View Course', 'cp' )
    
    		),
    
    		'public'              => true,
    
    		'exclude_from_search' => false,
    
    		'has_archive'         => true,
    
    		'show_ui'             => false,
    
    		'publicly_queryable'  => true,
    
    		'capability_type'     => 'course',
    
    		'map_meta_cap'        => true,
    
    		'query_var'           => true,
    
    		'supports'            => array( 'thumbnail' ),
    
    		'taxonomies'          => array( 'course_category' ),
    
    		//coursepress_course_categories_cap
    
    	);
    
    	register_post_type( 'course', $args );
    
    }
    
    add_action( 'coursepress_after_custom_post_types', 'register_custom_posts' );

    In order to don't lose this feature when you update the theme, I recommend you use a child theme. Take a look in the link below:

    https://premium.wpmudev.org/blog/how-to-create-wordpress-child-theme/

    I hope this information has been helpful. If I can help you in this or other questions, please let me know!

    Cheers, Luís

  • Christina

    Thank you, Luis. I've had a pretty good day. I added this to the functions file in my child theme, but the search didn't bring up any courses. I tried a different browser and got the same result. I also checked the BuddyPress Global Search list and courses don't show up as an option in the list of items to search. Is there anything in that code that I needed to edit to work for me?

  • Luís

    Hi @Christina,

    I hope had been good today!

    I tested in my installation and everything works well.

    You activated the child theme in Appearance -> Themes, right?

    If you are having difficulties or questions, send us your FTP and WordPress access.

    Please send it privately through our contact form:

    https://premium.wpmudev.org/contact/

    Select "I have a different question" for your topic - this and the subject line ensure that it gets assigned to me.

    Send in:

    Subject: "Attn: Luis Lopes"
    -WordPress admin username
    -WordPress admin password
    -login url
    -FTP credentials (host/username/password)
    -link back to this thread for reference
    -any other relevant urls

    **If you keep support access active then no need to send in wp-admin

    Cheers, Luís

Thank NAME, for their help.

Let NAME know exactly why they deserved these points.

Gift a custom amount of points.