我一直面临着这个特殊的问题。我是WordPress开发的新手,我一直在尝试建立一个女佣列表网站和其他一些服务。为此,我为他们创建了三种自定义帖子类型。然而,当我在导航菜单中放置自定义slug时,按钮似乎被单击了,但没有切换。但是,它可以在主页和我添加的任何其他页面上运行。以下是该网站的链接:http://dougleschan.com/kteamhelpers/
还要检查手机版本。
这是女佣的模板,
<?php /* Template Name: Maids and Nannies */ ?>
<?php get_header(); ?>
<h2 class="page-title"><?php post_type_archive_title(); ?></h2>
<?php
$args = array(
\'post_type\' => \'maids\',
\'orderby\' => \'meta_value\',
\'meta_key\' => \'code\',
\'posts_per_page\' => 15,
\'paged\' => $paged
);
query_posts($args);
add_filter( \'the_title\', \'max_title_length\');
?>
<?php if (have_posts()) : ?>
<div class="profiles-wrapper">
<ul class="profiles-overview">
<?php while (have_posts()) : the_post(); ?>
<li class="item">
<a href="<?php the_permalink(); ?>" title="">
<?php if ( has_post_thumbnail() ) { ?>
<?php the_post_thumbnail(\'profile-small\', array(\'class\' => \'aligncenter\')); ?>
<?php } else { ?>
<img class="profiles-img" src="<?php bloginfo(\'stylesheet_directory\'); ?>/images/default-profile-small.png" alt="" />
<?php } ?>
</a>
<div class="description">
<h4 class="post-name"><?php echo $post->post_title; ?></h4>
<ul>
<?php if (get_field(\'nationality\')) { ?>
<li><?php the_field(\'nationality\'); ?></li>
<?php } ?>
<?php if (get_field(\'age\')) { ?>
<li><span>Age</span>: <?php the_field(\'age\'); ?></li>
<?php } ?>
<?php if (get_field(\'experience\')) { ?>
<li><span>Experience</span>: <?php the_field(\'experience\'); ?>
<?php if(get_post_meta($post->ID, \'experience\', true) == \'1\') { ?>
year
<?php } else { ?>
years
<?php } ?>
</li>
<?php } ?>
<?php if (get_field(\'code\')) { ?>
<li><span>Code</span>: <?php the_field(\'code\'); ?></li>
<?php } ?>
</ul>
<div class="viewprofile"><a href="<?php the_permalink(); ?>" title="">View profile <i class="fa fa-caret-right"></i></a></div>
</div>
</li>
<?php endwhile; ?>
</ul>
</div>
<div class="pagination"><?php wp_pagenavi(\'query_posts\' == $args); ?></div>
<?php else: ?>
<p>No <span style="text-transform: lowercase;"><?php post_type_archive_title(); ?></span> available.</p>
<?php endif; ?>
<?php wp_reset_query(); ?>
<?php get_footer(); ?>