我的wordpress网站URL如下:https://example.com/?pid=a125a5&lang=en 并按如下方式查询我的存档页面:
<?php
$the_slug = get_query_var(\'pid\');
if ($the_slug){
if ( $post = get_page_by_path( $the_slug, OBJECT, \'myposttype\' ) )
$id = $post->ID;
else
$id = 0;
?>
<?php get_header(); ?>
<div class="warpper">
<?php ;
$args = array(
\'name\' => $the_slug,
\'post_type\' => \'myposttype\',
\'post_status\' => \'publish\',
\'numberposts\' => 1,
);
$query = new WP_Query( $args );
if ( $query->have_posts() ) : while ( $query->have_posts() ) : $query->the_post(); ?>
<?php the_title(); ?>
<?php endwhile; else: ?><?php endif; ?>
<php } else{...};
它的工作,但命令像
is_single()
返回false,wordpress在管理栏中不显示编辑帖子。