2016-11-07 4 views
1

私はWordpressを初めて使用しています。Wordpress関数がページのレンダリングを停止します

<a href="<?php echo site_url(); ?>/wp-content/themes/woffice-child-theme/page-templates/loginF.php"><img src="./wp-content/themes/woffice-child-theme/page-templates/images/signin-btn.png"></a> 

loginF.phpない負荷が、ページに、私はHOME_URLのような任意のワードプレスの関数を呼び出すどこから()またはwp_login_form(:私は次のリンクをwordpressのページから別のページに移動してい

)ページがレンダリングを停止します。たとえば、ページの先頭にhome_url()を置くと、ブラウザに空のページが表示されます。なぜこうなった?私は何とかWordPressのコンテキストの外出ですか?何をすべきか?

<html> 

<?php 
    $redirect_url = home_url(); 

?> 

    <head> 
    <title>Title</title> 
    <meta charset="UTF-8"> 
    <meta name="viewport" content="width=device-width, initial-scale=1.0"> 
    <link rel="stylesheet" type="text/css" href="/wp-content/themes/woffice-child-theme/page-templates/style2.css"> 
    <link href="https://fonts.googleapis.com/css?family=Lato:300,400,700" rel="stylesheet"> 
    <link href='https://fonts.googleapis.com/css?family=Open+Sans:400,700,300' rel='stylesheet' type='text/css'> 
    </head> 
    <body> 

    <div class="frontpage-content">  
     <div class="front-wrap"> 
     <br/> 
     <div class="new-login-logo text-center"><img src="/wp-content/themes/woffice-child-theme/page-templates/images/new-login-logo.png"></div> 
     <br/><br/> 
     <div class="frontpage-fields"> 
      <input type="text" name="log" id="user" class="input" placeholder="Email Address"> 
      <input type="password" name="pwd" id="pass" class="input" placeholder="Password"> 
     </div> 
     <div class="forgot-password-new"><a href="#">Forgot your password?</a></div> 
     <br/> 
     <div class="text-center"><a href="#"><img src="./images/captcha-image.png"></a></div> 
     <br/> 
     <div class="text-center new-login-space"><a href="#"><img src="/wp-content/themes/woffice-child-theme/page-templates/images/new-login-btn.png"></a></div> 



     </div> 
    </div> 

    </body> 
</html> 

答えて

0

ワードプレス標準に従って新しいページテンプレートを作成します。

<?php 
/** 
* Template Name: My Custom Page 
*/ 
get_header(); ?> 

<!-- Your code goes here --> 

<?php get_footer(); ?> 

https://developer.wordpress.org/themes/template-files-section/page-template-files/page-templates/

そして、バックエンド&保存にテンプレートとして(テンプレート名は、テンプレートファイルのヘッダー呼び出しの前に与えられている)WordPressのバックエンドから新しいページを作成して、ページテンプレート名を選択ページ。

[公開]ボタンの下のページ属性セクションで、ページテンプレートを選択できます。

Screenshot attached

最後に、テンプレートファイルを呼び出す代わりにhref値としてごアンカータグで、この新しいページのURLを呼び出します。

ページのタイトルまたはページのスラッグからページURLを取得できます。

get_permalink(get_page_by_path('your-page-slug')) 

get_permalink(get_page_by_title('Your page title')) 
0

が、これは全体のページのHTMLである:ここで

はloginF.phpありますか?それはあなたがWordpressの内の任意のページにページ・テンプレートを割り当て、現在使用しての代わりに、ページのURLを使用する必要があります

<?php get_header(); ?> 

で始まり、

<?php get_footer(); ?> 
+0

追加されましたが、状況は同じです。 – user3151013

0

で終わる必要があります。現在、間違った方法で使用しています。それを修正してください。テンプレート内でget_header()とget_footer()を呼び出すことも忘れないでください。

+0

ページテンプレートをページに割り当てるにはどうすればよいですか? – user3151013

+0

http://www.hongkiat.com/blog/wordpress-custom-loginpage/ –

0

私たちはこの別の方法で来るかもしれません。あなたのリンクはページテンプレートにリンクしていますが、少し奇妙なURLではありません。おそらく、これはWordpressを混乱させ、無限ループに陥る原因になるでしょう。

なぜこれにリンクしようとしていますか?それは別の解決策があるので、別注スタイルのログインページ用ですか?

あなたは

// log in logo link 
    add_filter('login_headerurl', 'custom_loginlogo_url'); 
     function custom_loginlogo_url($url) { 
     return 'http://www.yourlink.co.uk'; 
    } 
    // login logo 
    function my_login_logo() { ?> 
     <style type="text/css"> 
     body.login div#login h1 a { 
      background-image: url(<?php echo get_stylesheet_directory_uri(); ?>/library/images/logo.png); 
      padding-bottom: 15px; 
      height: 74px; 
      width: auto; 
      background-size: 60% auto; 
     } 
     </style> 
    <?php } 
    add_action('login_enqueue_scripts', 'my_login_logo'); 

のfunctions.phpあなたのテーマにこのコードを配置することにより、通常のWordpressのログインページのロゴを変更することができそれからちょうどリンクwww.yourdomain.co.uk/wp-adminする

あなたはこの

<?php /* Template Name: my-template */ ?> 

ようなもので開き、そのページに含まれている必要があり、現在、作品テンプレートファイルを使用して、カスタムログインページを使用しようとしている場合

しかし、。次にWordPressの管理者でページを作成し、テンプレート "my-template"を選択し、代わりにそのページのURLにリンクします。

+0

はい、カスタムログインページです。それを他の方法で統合する方法は? – user3151013

関連する問題