2016-04-14 11 views
2

私はWordPressを初めて使用しています。私は最近自分のhtmlウェブサイトを作ってワードプレスに変換しました。それはWordPressでうまくいきます。しかし1つの問題があり、それは私がWordPressを通してウェブサイトの内容を変えることができないことです。たぶん私は私のテーマのindex.phpでHTMLをコード化しているためですが、その効果があるかどうかはわかりません。WordPressで自分のhtmlをWordPressテーマに編集できません

  1. のindex.php

  2. footer.php

  3. header.phpの

  4. のstyle.css

  5. スクリーンショット: は今の私のテーマは、次のファイルを持っています.png

  6. CSS(フォルダ)

  7. JS(フォルダ)

  8. フォント(フォルダ)

  9. IMG(フォルダ)

ヘルプの任意の種類を大幅に理解されるであろう。

+0

を使用して、独自の子テーマを作りますか?各パーツごとにテンプレートが必要です。 –

+0

あなたはどのテーマを使用していますか? –

+0

私はちょうど私のページの内容をwordpressで編集しようとしています。私が作成するすべての新しいページも同じように見えます。私はそれがindex.phpファイルにHTMLをコード化したからだということを知っています。 –

答えて

1

あなたのindex.phpのすべてのHTMLをハードコードしないでください。WPループを使用してテンプレートを作成し、これらのテンプレートを使用してWordpress Adminでページを作成してください。あなたが二十フィフティーンWordpressのテーマを使用している場合たとえば、あなたの主なテンプレートは次のようになります

<?php 
/** 
* The main template file 
* Template Name: Front_Page 
* 
* This is the most generic template file in a WordPress theme 
* and one of the two required files for a theme (the other being style.css). 
* It is used to display a page when nothing more specific matches a query. 
* e.g., it puts together the home page when no home.php file exists. 
* 
* Learn more: {@link https://codex.wordpress.org/Template_Hierarchy} 
* 
* @package WordPress 
* @subpackage Twenty_Fifteen 
* @since Twenty Fifteen 1.0 
*/ 
    get_header(); ?> 

    <div id="primary" class="content-area"> 
     <main id="main" class="site-main" role="main"> 

     <?php if (have_posts()) : ?> 

      <?php if (is_home() && ! is_front_page()) : ?> 
       <header> 
        <h1 class="page-title screen-reader-text"><?php single_post_title(); ?></h1> 
       </header> 
      <?php endif; ?> 

      <?php 
      // Start the loop. 
      while (have_posts()) : the_post(); 

       /* 
       * Include the Post-Format-specific template for the content. 
       * If you want to override this in a child theme, then include a file 
       * called content-___.php (where ___ is the Post Format name) and that will be used instead. 
       */ 
       get_template_part('content', get_post_format()); 

      // End the loop. 
      endwhile; 

      // Previous/next page navigation. 
      the_posts_pagination(array(
       'prev_text'   => __('Previous page', 'twentyfifteen'), 
       'next_text'   => __('Next page', 'twentyfifteen'), 
       'before_page_number' => '<span class="meta-nav screen-reader-text">' . __('Page', 'twentyfifteen') . ' </span>', 
      )); 

     // If no content, include the "No posts found" template. 
     else : 
      get_template_part('content', 'none'); 

     endif; 
     ?> 

     </main><!-- .site-main --> 
    </div><!-- .content-area --> 

<?php get_footer(); ?> 

が続いてフロントページを作成します。ページで新しいページの追加]を選択します。タイトル「ホーム」。あなたのHTML動的コンテンツをコンテンツエリアに置きます。前に作成したテンプレートFront_Pageを選択します(右側のサイドバーから)。詳細については、WPコーデックスリンクを参照してください。 WordPress Static Front Page Process

これでページの内容を変更するには、WP管理パネルのページを編集するだけです。お役に立てれば。

編集1:伝統的にやっているように、またはテーマのfunction.phpを通して、スタイルシートとJsファイルをヘッダファイルにエンキューできます。情報については、Including CSS & JavaScriptおよびwp_enqueue_styleを参照してください。

編集2:はい、より良い既存のテーマを使用して、それをカスタマイズしたり、編集しようとしているWordPressのサイトのセクション既存のテーマWP Child Theme

+0

この "テンプレート"ファイルの具体的な名前は何ですか?それはpage.phpですか? –

+0

@SHARJEELIMTIAZ、上記はメインテンプレートindex.phpの例です –

関連する問題