我已经为我的自定义帖子创建了WordPress插件。我已经尝试了所有存档解决方案,我在Youtube和StackExchange上找到了这些解决方案,但都不起作用。
我已经多次刷新permalink并尝试了其他选项。
localhost/westernlogan/articles/ - 此存档链接出现错误(哎呀!找不到该页。)(甚至我也尝试过删除结束斜杠的链接)
localhost/westernlogan/articles/what-is-computer-aided-design-cad/ - 此链接工作正常
archive-articles.php - 存档页面名称
<?php
/*
Plugin Name: Westernlogan Dashboard
Plugin URI: http://www.westernlogan.com/
Description: This is not just a Dashboard, it symbolizes the hope and
enthusiasm of an entire generation summed up in two words sung most famously
by Westernlogan.
Author: Harshad
Version: 1.0
Author: Westernlogan
Author URI: http://www.westernlogan.com/
*/
add_action(\'init\', \'articles_post_type\');
add_action(\'init\', \'custom_taxonomy\');
function articles_post_type() {
$args = array(
\'labels\' => array(
\'name\' => _x( \'Articles\', \'lr_article\' ),
\'singular_name\' => _x( \'Article\', \'lr_article\' ),
\'menu_name\' => _x( \'Articles\', \'lr_article\' ),
\'name_admin_bar\' => _x( \'Article\', \'lr_article\' ),
\'add_new\' => _x( \'Add New\', \'lr_article\' ),
\'add_new_item\' => __( \'Add New article\', \'lr_article\' ),
\'new_item\' => __( \'New article\', \'lr_article\' ),
\'edit_item\' => __( \'Edit article\', \'lr_article\' ),
\'view_item\' => __( \'View article\', \'lr_article\' ),
\'all_items\' => __( \'All articles\', \'lr_article\' ),
\'search_items\' => __( \'Search articles\', \'lr_article\' ),
\'parent_item_colon\' => __( \'Parent articles:\', \'lr_article\' ),
\'not_found\' => __( \'No articles found.\', \'lr_article\' ),
\'not_found_in_trash\' => __( \'No articles found in Trash.\', \'lr_article\' )
),
\'query_var\' => \'Articles\',
\'rewrite\' => array(
\'slug\' => \'articles\',
\'with_front\' => false
),
\'public\' => true,
// \'menu_position\' => 5,
\'menu_icon\' => plugin_dir_url(__FILE__) . \'av-logo.png\',
\'supports\' => array(
\'title\',
\'editor\',
\'thumbnail\',
\'excerpt\'
)
);
flush_rewrite_rules();
register_post_type(\'articles\', $args);}
function custom_taxonomy() {
$taxonomies = array(
\'hierarchical\' => true,
\'query_var\' => \'Articles_category\',
\'rewrite\' => array(
\'slug\' => \'article-category\',
),
\'labels\' => array(
\'name\' => \'Articles Category\',
\'singular_name\' => \'Articles Category\',
\'edit_item\' => \'Edit Articles Category\',
\'update_item\' => \'Update Articles Category\',
\'add_new_item\' => \'Add Articles Category\',
\'new_item_name\' => \'Add New Articles Category\',
\'all_items\' => \'All Articles Category\',
\'search_items\' => \'Search Articles Category\',
\'popular_items\' => \'Popular Articles Category\',
\'separate_items_with_comments\' => \'Separate articles Category with Commas\',
\'add_or_remove_items\' => \'Add or Remove articles Category\',
\'choose_from_most_used\' => \'Choose from most used articles Category\'));
register_taxonomy(\'articles_category\', array(\'articles\'), $taxonomies);}
这是我的。htaaccess设置(如果需要)
# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /westernlogan/
RewriteRule ^index\\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /westernlogan/index.php [L]
</IfModule>
# END WordPress
# WP Maximum Execution Time Exceeded
<IfModule mod_php5.c>
php_value max_execution_time 300
php_value upload_max_filesize 20M
php_value post_max_size 20M
php_value max_input_time 300
</IfModule>