0

我正在尝试创建自己的主题,称为“音乐学院”。为此,我首先在 style.css 中添加了这些信息:

/*
Theme Name: Conservatoire
Theme URI: http://wordpress.org/
Description: Conservatoire
Author: Thoma Biguères
Version: 1.0
Tags: black, blue, white, two-columns, fixed-width, custom-header, custom-background,     threaded-comments, sticky-post, translation-ready, microformats, rtl-language-support, editor-style, custom-menu (optional)

License:
License URI:

General comments (optional).
*/

所以我认为这里没什么太棘手的。之后我添加了两个文件。一个 index.php :

<?php
/**
* The main template file.
*
* @package WordPress
* @subpackage Conservatoire
*/

get_header(); ?>

<!-- Add your site or application content here -->    

<!-- JavaScript at the bottom for fast page loading: http://developer.yahoo.com/performance/rules.html#js_bottom -->

<!-- Grab Google CDN's jQuery, with a protocol relative URL; fall back to local if offline -->
<script src="//ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script>
<script>window.jQuery || document.write('<script src="js/vendor/jquery-1.7.2.min.js"><\/script>')</script>

<!-- scripts concatenated and minified via build script -->
<script src="js/plugins.js"></script>
<script src="js/main.js"></script>
<!-- end scripts -->

<!-- Asynchronous Google Analytics snippet. Change UA-XXXXX-X to be your site's ID.
     mathiasbynens.be/notes/async-analytics-snippet -->
<script>
    var _gaq=[['_setAccount','UA-XXXXX-X'],['_trackPageview']];
    (function(d,t){var g=d.createElement(t),s=d.getElementsByTagName(t)[0];
    g.src=('https:'==location.protocol?'//ssl':'//www')+'.google-analytics.com/ga.js';
    s.parentNode.insertBefore(g,s)}(document,'script'));
</script>
</body>
</html>

直到这里一切正常。之后,我添加了一个 front-page.php,这是我的静态主页:

<?php
/**
* The template for displaying Front page.
*
* @package WordPress
* @subpackage Conservatoire
*/

get_header(); ?>

<?php
$page = get_page_by_title('Accueil');
?>

一切都还好。现在事情很棘手。我正在尝试添加一个 category-{slug}.php 页面。所以我创建了一个对我来说很好的页面 category-membre.php :

<?php
/**
* T he template for displaying Front page.
*
* @package WordPress
* @subpackage Conservatoire
*/

get_header(); ?>

<ul>
<?php if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<li class="cadre">
    <div class="imageCadre">
        <?php echo(get_image());?>
    </div>
    <h4><?php echo(get_the_title());?></h4>
    <p><?php echo(get('information_globales_petite_description'));?></p>
    <a href="" class="plusinfo">Lire la suite</a>

</li>
<?php endwhile; ?>
<!-- post navigation -->
<?php else: ?>
<!-- no posts found -->
<?php endif; ?>


</ul>
</body>
</html>
?>

但是当我尝试进入“localhost/Site/category/membre”页面时,我发现自己在 404 页面上......

有人知道吗?

谢谢

编辑:我没有更改永久链接,因此类别库为空(我猜它是类别,不是吗?)

这是我的httaccess,但我删除了它,它仍然给我同样的错误:

新编辑:这是实际的 .htaccess

# BEGIN WordPress
<IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /Sites/Association%20CNMP/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /Sites/Association%20CNMP/index.php [L]
</IfModule>

# END WordPress
4

1 回答 1

1

嘿,谢谢你的一切,

我设法使永久链接起作用。我真的不知道你是怎么想的。我知道我必须将 apache 的 httdconfig 的 mod_rewrite 设置为 Ok(在 Launch mod_rewrite 之前擦除 #)。然后做一些事情。不过有一件事我不明白!

为什么我的实际 htaccess 看起来像这样:

# BEGIN WordPress
 <IfModule mod_rewrite.c>
RewriteEngine On
RewriteBase /Sites/AssociationCNMP/
RewriteRule ^index\.php$ - [L]
RewriteCond %{REQUEST_FILENAME} !-f
RewriteCond %{REQUEST_FILENAME} !-d
RewriteRule . /Sites/AssociationCNMP/index.php [L]
</IfModule>

# END WordPress

但实际上是在使用 cat/membre 吗?我在 htaccess 文件中没有看到猫。那么他怎么知道他必须去另一个呢?

谢谢你的帮助

于 2012-07-24T20:48:36.573 回答