2013-08-20 5 views
0

헤더에 사용자 정의 URL을 추가해야합니다. Header.php를 편집하고 다음 코드를 추가했습니다 : <?php print "<a href=localhost/URL1>URL1</a>/<a href=localhost/URL2>URL2</a>"; ?>하지만 어떤 이유로 URL1과 URL2가 작동하지 않습니다 .... 누군가이 문제를 해결할 수 있습니까?WordPress 헤더에 사용자 정의 URL 추가

편집 : 여기 여기 좋아

<?php 

// Exit if accessed directly 
if (!defined('ABSPATH')) exit; 

/** 
* Header Template 
* 
* 
* @file   header.php 
* @package  Responsive 
* @author   Emil Uzelac 
* @copyright  2003 - 2013 ThemeID 
* @license  license.txt 
* @version  Release: 1.3 
* @filesource  wp-content/themes/responsive/header.php 
* @link   http://codex.wordpress.org/Theme_Development#Document_Head_.28header.php.29 
* @since   available since Release 1.0 
*/ 
?> 
<!doctype html> 
<!--[if !IE]>  <html class="no-js non-ie" <?php language_attributes(); ?>> <![endif]--> 
<!--[if IE 7 ]> <html class="no-js ie7" <?php language_attributes(); ?>> <![endif]--> 
<!--[if IE 8 ]> <html class="no-js ie8" <?php language_attributes(); ?>> <![endif]--> 
<!--[if IE 9 ]> <html class="no-js ie9" <?php language_attributes(); ?>> <![endif]--> 
<!--[if gt IE 9]><!--> <html class="no-js" <?php language_attributes(); ?>> <!--<![endif]--> 
<head> 

<meta charset="<?php bloginfo('charset'); ?>" /> 
<meta name="viewport" content="width=device-width, initial-scale=1.0"> 

<title><?php wp_title('&#124;', true, 'right'); ?></title> 

<link rel="profile" href="http://gmpg.org/xfn/11" /> 
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> 

<?php wp_head(); ?> 
</head> 

<body <?php body_class(); ?>> 

<?php responsive_container(); // before container hook ?> 
<div id="container" class="hfeed"> 

    <?php responsive_header(); // before header hook ?> 
    <div id="header"> 

     <?php responsive_header_top(); // before header content hook ?> 

     <?php if (has_nav_menu('top-menu', 'responsive')) { ?> 
      <?php wp_nav_menu(array(
        'container'  => '', 
        'fallback_cb'  => false, 
        'menu_class'  => 'top-menu', 
        'theme_location' => 'top-menu') 
        ); 
       ?> 
     <?php } ?> 

    <?php responsive_in_header(); // header hook ?> 

    <?php if (get_header_image() != '') : ?> 

     <div id="logo"> 
    <a href="<?php echo home_url('/'); ?>"><img src="<?php header_image(); ?>" width="<?php if(function_exists('get_custom_header')) { echo get_custom_header() -> width;} else { echo HEADER_IMAGE_WIDTH;} ?>" height="<?php if(function_exists('get_custom_header')) { echo get_custom_header() -> height;} else { echo HEADER_IMAGE_HEIGHT;} ?>" alt="<?php bloginfo('name'); ?>" /></a> 
     </div><!-- end of #logo --> 

    <?php endif; // header image was removed ?> 

    <?php if (!get_header_image()) : ?> 

     <div id="logo"> 
      <span class="site-name"><a href="<?php echo home_url('/'); ?>" title="<?php echo esc_attr(get_bloginfo('name', 'display')); ?>" rel="home"><?php bloginfo('name'); ?></a></span> 
    <?php echo "<a href='www.google.com'>URL1</a>/<a href='www.google.com'>URL2</a>"?>; 
      <span class="site-description"><?php bloginfo('description'); ?></span> 
     </div><!-- end of #logo --> 
    <?php endif; // header image was removed (again) ?> 

    <?php get_sidebar('top'); ?> 
       <?php wp_nav_menu(array(
        'container'  => 'div', 
         'container_class' => 'main-nav', 
         'fallback_cb'  => 'responsive_fallback_menu', 
         'theme_location' => 'header-menu') 
        ); 
       ?> 

      <?php if (has_nav_menu('sub-header-menu', 'responsive')) { ?> 
       <?php wp_nav_menu(array(
        'container'  => '', 
        'menu_class'  => 'sub-header-menu', 
        'theme_location' => 'sub-header-menu') 
        ); 
       ?> 
      <?php } ?> 

      <?php responsive_header_bottom(); // after header content hook ?> 

    </div><!-- end of #header --> 
    <?php responsive_header_end(); // after header container hook ?> 

    <?php responsive_wrapper(); // before wrapper container hook ?> 
    <div id="wrapper" class="clearfix"> 
     <?php responsive_wrapper_top(); // before wrapper content hook ?> 
     <?php responsive_in_wrapper(); // wrapper hook ?> 

코드 외경 header.php입니다 header.php 코드를입니다. 맞춤 URL을 추가했지만 웹 사이트에 표시되지 않습니다.

+0

그래서입니다 전체 URL을 사용하려고하지만 그냥 작동, 또는 아무튼하지 않습니다 나타나지도 않니? – Matheno

+0

표시되지 않습니다. 심지어 페이지 소스를 확인하고 내가 추가 한 URL이 없었습니다. – user2496520

+0

확인. 이를 URL로 변경하고 URL을 볼 수 있는지 확인하십시오. URL1/URL2"; ?> – Matheno

답변

-2

무엇이 작동하지 않습니까? 링크를 클릭하면 404가 제공됩니까?

404이면 제안 된대로 href를 유효한 URI로 변경하십시오.

header.php에 추가 된 항목은 프론트 엔드에 표시되므로 href uri 만 문제가 될 수 있습니다. 제공 한 정보는 계속됩니다.

행운을 빕니다 :)

+0

웹 사이트의 URL이 표시되지 않는 문제가 있습니다. 왜 그들이 표시되지 않습니다 모르겠어요 .... – user2496520

+0

왜 downvote? 내 답변이 다른 사람들과 비교해서 나쁘다는 이유로 투표를해야만합니까? – gwillie

0

당신이 어떤 헤더 이미지를하지 않으며 경우에만 두 URL을 보여줄 것입니다 의미

if (!get_header_image())

에 URL1와 URL2의 앵커 태그에 놓여있다이 경우 올바른 시도는 또한 당신을

<?php if (get_header_image() != '') : ?>

및 내부 코드를 배치합니다 URL의 잘못된 양식을 사용하여 당신은

<a href='www.google.com'>URL1</a>

를 사용하는

아니라, 당신은 URL을 볼 수 있습니다 <a href='http://www.google.com'>URL1</a>

관련 문제