I have been working on a site that is meant to have a car listing site but also social aspects for some time now , i created the car listing aspect of the site using a custom theme, that works as intended, but after setting up multiple themes plugin with this config
but when going into the site, for example https://huntx.local/activity/ all i see is my custom theme index, my custom theme doesnt have any buddypress templates so it should interfere as far as i know.
Tried to “graft” the buddyx template into my own, but its too advanced for me to understand and find the files that i need for this to work, all i managed is to get a blank screen instead of the index.
Im going to add the functions.php file from my custom theme in case is needed
<?php
function enqueue_tailwind_styles() {
// Enqueue the style.css file from the theme root
wp_enqueue_style('tailwind', get_template_directory_uri() . '/style.css', array(), '1.0.0', 'all');
}
add_action('wp_enqueue_scripts', 'enqueue_tailwind_styles');
remove_action( 'shutdown', 'wp_ob_end_flush_all', 1 );
function custom_login_page_redirect( $login_url ) {
return home_url( '/login/' );
}
add_filter( 'login_url', 'custom_login_page_redirect' );
function custom_buddypress_activation_redirect( $user ) {
if ( bp_is_activation_page() ) {
wp_redirect( home_url( '/activate/' ) );
exit();
}
return $user;
}
add_action( 'bp_core_signup_send_activation_key', 'custom_buddypress_activation_redirect' );
add_filter('bp_email_get_tokens', 'custom_bp_email_tokens', 10, 2);
function custom_bp_email_tokens($tokens, $args) {
if (isset($args['tokens']['key'])) {
$tokens['key'] = $args['tokens']['key'];
}
return $tokens;
}
function custom_car_listing_post_type() {
$labels = array(
'name' => _x( 'Car Listings', 'post type general name' ),
'singular_name' => _x( 'Car Listing', 'post type singular name' ),
'menu_name' => _x( 'Car Listings', 'admin menu' ),
'name_admin_bar' => _x( 'Car Listing', 'add new on admin bar' ),
'add_new' => _x( 'Add New', 'car listing' ),
'add_new_item' => __( 'Add New Car Listing' ),
'new_item' => __( 'New Car Listing' ),
'edit_item' => __( 'Edit Car Listing' ),
'view_item' => __( 'View Car Listing' ),
'all_items' => __( 'All Car Listings' ),
'search_items' => __( 'Search Car Listings' ),
'parent_item_colon' => __( 'Parent Car Listings:' ),
'not_found' => __( 'No car listings found.' ),
'not_found_in_trash' => __( 'No car listings found in Trash.' )
);
$args = array(
'labels' => $labels,
'description' => __( 'A custom post type for car listings.' ),
'public' => true,
'publicly_queryable' => true,
'show_ui' => true,
'show_in_menu' => true,
'query_var' => true,
'rewrite' => array( 'slug' => 'car-listing' ),
'capability_type' => 'post',
'has_archive' => true,
'hierarchical' => false,
'menu_position' => null,
'supports' => array( 'title', 'editor', 'author', 'thumbnail', 'excerpt', 'comments' ),
'taxonomies' => array( 'category', 'post_tag' )
);
register_post_type( 'car-listing', $args );
}
add_action( 'init', 'custom_car_listing_post_type' );
add_action('after_setup_theme', 'remove_admin_bar');
function remove_admin_bar() {
if (!current_user_can('administrator') && !is_admin()) {
show_admin_bar(false);
}
}
//subscriber can upload media
function add_subscriber_upload_capability() {
$role = get_role('subscriber');
$role->add_cap('upload_files');
}
add_action('init', 'add_subscriber_upload_capability');
function restrict_media_library_to_users_own_uploads($query) {
$user_id = get_current_user_id();
if (current_user_can('subscriber') && !current_user_can('edit_others_posts')) {
$query['author'] = $user_id;
}
return $query;
}
add_filter('ajax_query_attachments_args', 'restrict_media_library_to_users_own_uploads');