以下のhtmlコードでwordpressの記事の一覧を表示させるソースを作りました。
そして、サーバは、ロリポップにアップして、.htaccessに.htmlファイルでもphpが動作するコードを書き込んで該当.htmlファイルのあるフォルダにアップしたんですが、
普通にHTMLは表示されるのですが、PHPが動作せず、記事の一覧が表示されません。
php.iniでエラーログを出すようにしてみましたがエラーはないようです。
念のためhtml側に
ini_set( 'display_errors', 1 );
と記述してアップしてみましたがエラーログはでませんでした。
原因を教えて頂けると幸いです。
[html&PHP]
<?php require_once('./wp/wp-load.php'); ?> <!DOCTYPE HTML> <html> <head> <meta charset="UTF-8"> <link rel="stylesheet" type="text/css" href="css/top_style.css"> <title>TEST</title> </head> <body> <header class="main_header clearfix"> <p class="header_p1"><a href="index.html"></a></p> <p class="header_p2">TEST</p> </header> <!-- title_img --> <section id="title_img"> </section> <!-- title_img --> <!-- top_menu --> <nav id="top_menu" class="clearfix"> <ul> <li class="menu_01"> <h1><a href="index.html"><span>TEST</span></a></h1> </li> <li class="menu_02"><a href="concept.html">コンセプト</a></li> <li class="menu_03"><a href="gallery.html">ギャラリー</a> </li> <li class="menu_04"> <a href="production_flow.html">制作の流れ</a></li> <li class="menu_04"> <a href="production_fee.html">料金</a></li> <li class="menu_05"><a href="order.html">注文</a></li> <li class="menu_06"><a href="company.html">会社概要</a></li> <li class="menu_07"></a><a href="contact.html">問い合わせ</a></li> </ul> </nav> <!-- top_menu --> <!-- top_box --> <section id="top_box" class="clearfix"> <!-- news_box --> <article id="news_box"> <p class="new_title_p"><img src="img/new.jpg" width="400" height="46" alt="新着情報"></p> <?php $posts = get_posts("numberposts=5&category=&orderby=post_date&offset=0"); foreach ($posts as $post): setup_postdata($post); ?> <li> <?php the_time('Y.m.d') ?> <a href="<?php the_permalink() ?>"><?php the_title() ?><?php the_post_thumbnail('thumbnail'); ?></a> <?php echo mb_substr(get_the_excerpt(), 0, 30); echo '...' ; ?> </li> <?php endforeach; ?> </article> <!-- news_box --> <!-- tw_box --> <article id="tw_box"> </article> <!-- tw_box --> </section> <!-- top_box --> <!-- footer --> <footer> <p class="footer_p"><small>Copyright (C) XXXX. all rights reserved.</small></p> </footer> <!-- footer --> </body> </html>
[.htaccess]
AddHandler php7.1-script html # BEGIN WordPress <IfModule mod_rewrite.c> RewriteEngine On RewriteBase / RewriteRule ^index.php$ - [L] RewriteCond %{REQUEST_FILENAME} !-f RewriteCond %{REQUEST_FILENAME} !-d RewriteRule . /index.php [L] </IfModule> # END WordPress
PHPは7.1(CGI)です。
回答1件
あなたの回答
tips
プレビュー