提问人:sappho7124 提问时间:11/1/2023 最后编辑:sappho7124 更新时间:11/1/2023 访问量:16
使用自定义主题和 BuddyX 的多个主题在 Wordpress 网站上不起作用
Multiple themes not working on Wordpress site using a custom theme and BuddyX
问:
一段时间以来,我一直在一个旨在拥有汽车列表网站和社交方面的网站上工作,我使用自定义主题创建了该网站的汽车列表方面,该主题按预期工作,但是在设置了多个主题插件后使用此配置,但是在进入该站点时, 例如,https://huntx.local/activity/ 我看到的只是我的自定义主题索引,但我的自定义主题没有任何 BuddyPress 模板,所以据我所知它应该会干扰。
试图将 buddyx 模板“嫁接”到我自己的模板中,但它太高级了,我无法理解和找到我需要的文件,我所做的只是得到一个空白屏幕而不是索引。
如果需要,我将从我的自定义主题添加函数.php文件
<?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');
答: 暂无答案
评论