はじめまして。
つい一週間ほど前にWordPressを始めた者です。
恥ずかしながらPHPについての知識はほぼありません…。
使用しているプラグイン名:PHP Execution
テーマ名:Clipso 1.0 : NewWpThemes 作 Free General/Blog WordPress theme by NewWpThemes
使用しているブラウザ:グーグルクローム
私は固定ページに記事一覧を表示させているのですが、固定ページのタイトルが投稿記事と同じ扱いになってしまい困っております。通常の投稿記事のように作成した日付やread moreの表示がくっついてしまうのです。固定ページテンプレート (page.php)に原因があるのだろうと思い、いじってみるのですがそれだと本来の投稿記事の作成時間など、表示させたいものまで一緒に消えてしまいます。固定ページテンプレートの内容はindexページにあったものをそのまま持ってきています。
<?php global $theme; get_header(); ?>
<div id="main">
<?php $theme->hook('main_before'); ?>
<div id="content">
<?php $theme->hook('content_before'); ?>
<?php
if (have_posts()) : while (have_posts()) : the_post();
/**
* The default post formatting from the post.php template file will be used.
* If you want to customize the post formatting for your homepage:
*
* - Create a new file: post-homepage.php
* - Copy/Paste the content of post.php to post-homepage.php
* - Edit and customize the post-homepage.php file for your needs.
*
* Learn more about the get_template_part() function: http://codex.wordpress.org/Function_Reference/get_template_part
*/
get_template_part('post', 'homepage');
endwhile;
else :
get_template_part('post', 'noresults');
endif;
get_template_part('navigation');
?>
<?php $theme->hook('content_after'); ?>
</div><!-- #content -->
<?php get_sidebars(); ?>
<?php $theme->hook('main_after'); ?>
</div><!-- #main -->
<?php get_footer(); ?>
ここのフォーラムやグーグルで調べたところ、同じように固定ページのタイトルを非表示にする方法があったので、
<?php if(is_page(9)||is_page(20)): ?>
<h2 class="post_title"><?php the_title(); ?></h2>
<?php endif; ?>
をいれてみたりしたのですができませんでした…
そしてPHP Executionというプラグインを用いて、固定ページの記事の内容は次のようにしています。
<?php query_posts($query_string . 'showposts=5'); ?>
<?php if (have_posts()) : ?>
<?php while (have_posts()) : the_post(); ?>
<?php endwhile; ?>
<?php else : ?>
<?php endif; ?>
<?php query_posts($query_string . ""); ?>
一応固定ページに記事一覧は表示できているので、あとはタイトルが消せたら問題ないのですが…どうもここで行き詰ってしまい質問させていただきました。おかげで昨日は徹夜です…(笑)初歩的な質問かもしれませんが、どなたかご教授いただけないでしょうか。よろしくお願いします。