admin管理员组文章数量:1335596
I created a project form for adding projects,but when I create it,a wrong link create this is how I created project form:
add_action('init' , 'create_project');
function create_project()
{
$labels = array(
'name' => _x('پروژه های جدید', 'post type general name'),
'singular_name' => _x('پروژه', 'post type singular name'),
'add_new' => _x('افزودن', 'پروژه'),
'add_new_item' => __('افزودن پروژه'),
'edit_item' => __('ویرایش پروژه'),
'new_item' => __('جدید پروژه'),
'view_item' => __('نمایش پروژه'),
'search_items' => __('جستجوی پروژه'),
'not_found' => __('پروژهی وجود ندارد'),
'not_found_in_trash' => __('در زباله دان پروژهی نیست'),
'parent_item_colon' => __('ویرایش پروژه'),
);
$support = array('title', 'excerpt', 'custom-fields', 'editor', 'thumbnail');
register_post_type('project', array(
'labels' => $labels,
'supports' => $support,
'public' => true
));
}
single-project.php
<?php
get_header();?>
<?php if (have_posts()){ ?>
<section class="page-title parallax-section">
<div class="row-parallax-bg">
<div class="parallax-wrapper">
<div class="parallax-bg">
<img src="images/bg-image-54.jpg" alt="">
</div>
</div>
<div class="parallax-overlay"></div>
</div>
<div class="centrize">
<div class="v-center">
<div class="container">
<div class="single-post-info">
<h6><span><i class="hc-clock"></i>تاریخ پست</span><span class="post-time">22<?php the_date('D/M/Y') ?></span><span> در <a href="#"><?php the_category(); ?></a></span></h6>
<div class="title text-center">
<h1>لورم ایپسوم متن ساختگی با </h1>
</div>
<div class="post-author">
<img src="images/testimonial-2.jpg" alt=""><a href="#"><?php the_modified_author(); ?></a>
</div>
</div>
<?php the_meta(); ?>
</div>
</div>
</div>
</section>
<?php } ?>
the link that creating is:'http://localhost/wordpress/faradars/project/project/' and it open 404page can anyone help me to fix it?
I created a project form for adding projects,but when I create it,a wrong link create this is how I created project form:
add_action('init' , 'create_project');
function create_project()
{
$labels = array(
'name' => _x('پروژه های جدید', 'post type general name'),
'singular_name' => _x('پروژه', 'post type singular name'),
'add_new' => _x('افزودن', 'پروژه'),
'add_new_item' => __('افزودن پروژه'),
'edit_item' => __('ویرایش پروژه'),
'new_item' => __('جدید پروژه'),
'view_item' => __('نمایش پروژه'),
'search_items' => __('جستجوی پروژه'),
'not_found' => __('پروژهی وجود ندارد'),
'not_found_in_trash' => __('در زباله دان پروژهی نیست'),
'parent_item_colon' => __('ویرایش پروژه'),
);
$support = array('title', 'excerpt', 'custom-fields', 'editor', 'thumbnail');
register_post_type('project', array(
'labels' => $labels,
'supports' => $support,
'public' => true
));
}
single-project.php
<?php
get_header();?>
<?php if (have_posts()){ ?>
<section class="page-title parallax-section">
<div class="row-parallax-bg">
<div class="parallax-wrapper">
<div class="parallax-bg">
<img src="images/bg-image-54.jpg" alt="">
</div>
</div>
<div class="parallax-overlay"></div>
</div>
<div class="centrize">
<div class="v-center">
<div class="container">
<div class="single-post-info">
<h6><span><i class="hc-clock"></i>تاریخ پست</span><span class="post-time">22<?php the_date('D/M/Y') ?></span><span> در <a href="#"><?php the_category(); ?></a></span></h6>
<div class="title text-center">
<h1>لورم ایپسوم متن ساختگی با </h1>
</div>
<div class="post-author">
<img src="images/testimonial-2.jpg" alt=""><a href="#"><?php the_modified_author(); ?></a>
</div>
</div>
<?php the_meta(); ?>
</div>
</div>
</div>
</section>
<?php } ?>
the link that creating is:'http://localhost/wordpress/faradars/project/project/' and it open 404page can anyone help me to fix it?
Share Improve this question asked May 28, 2020 at 13:46 hadishadis 212 bronze badges 3- Have you made sure to flush your permalinks by going to Settings > Permalinks? – Jacob Peattie Commented May 28, 2020 at 13:54
- actully no,what should I do? – hadis Commented May 28, 2020 at 14:12
- Go to Settings > Permalinks. That’s it. – Jacob Peattie Commented May 28, 2020 at 14:50
1 Answer
Reset to default 0By analysis, your code maybe you should try
- Flush permalinks (This may solve this issue) because when we create custom post type in WordPress we should use
flush_rewrite_rules()
or manually update permalinks.
Hope it will solve this issue.
本文标签: theme developmentwordpress can39t find singleproject page
版权声明:本文标题:theme development - wordpress can't find single-project page 内容由网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://www.betaflare.com/web/1742393680a2466490.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论