【发布时间】:2014-01-03 18:01:33
【问题描述】:
更新后(或者可能没有),但在之前的一段时间,当我要去类别列表页面时 mysite.com/?cat=10 我得到不是 category.php 模板 - 它打开 single.php 为什么?
我正在尝试制作 category-10.php (仅用于测试),但仍会使用 single.php。 我应该在哪里查看我的问题? 问题出在我的 ajax 插件上,他的代码是:
<?php
/**
* Plugin Name: Ajax content loader
* Description: Load content througt ajax.
* Version: 0.1
*
*/
/**
* Initialization. Add our script if needed on this page.
*/
function ajax_content_init() {
global $wp_query;
// Add code to index pages.
if( !is_singular() ) {
// Queue JS
wp_enqueue_script(
'load-posts',
plugin_dir_url( __FILE__ ) . 'js/load-posts.js',
array('jquery'),
'1.0',
true
);
$wp_query->is_single = true;
}
}
add_action('template_redirect', 'ajax_content_init');
?>
有什么想法吗? 是手机版的,手机怎么激活?不适合桌面?
【问题讨论】:
-
您有示例代码可以提供吗?
-
你怎么知道显示的是
single.php,还要尝试禁用所有插件并检查。 -
category.php 或 single.php 的代码?但是如果我使用带有页脚和页眉功能的空白页,它也不会显示。
-
我正在通过 html 代码搜索,我得到了。
-
同样的 HTML 可能在你的 index.php 中