2012-05-31 1 views
0

내가 내 워드 프레스 사이트에서 일부 자바 스크립트를 구현 한 실종하지만자바 스크립트 오류 : jQuery를 정의하지 않고 잘못된 정규 표현식 :/

jQuery를이

을 정의되지 않은 페이지에 다음과 같은 오류 메시지가 무엇입니까 및

잘못된 정규 표현식 :/

이 누락 내 header.php 파일의 코드입니다. .js 파일을 편집해야하는지, 아니면이 섹션에서 중요한 것을 놓치고 있는지 잘 모르겠습니다.

<?php 
/** 
* The Header for our theme. 
* 
* Displays all of the <head> section and everything up till <div id="main"> 
* 
* @package WordPress 
* @subpackage Twenty_Eleven 
* @since Twenty Eleven 1.0 
*/ 
?><!DOCTYPE html> 
<!--[if IE 6]> 
<html id="ie6" <?php language_attributes(); ?>> 
<![endif]--> 
<!--[if IE 7]> 
<html id="ie7" <?php language_attributes(); ?>> 
<![endif]--> 
<!--[if IE 8]> 
<html id="ie8" <?php language_attributes(); ?>> 
<![endif]--> 
<!--[if !(IE 6) | !(IE 7) | !(IE 8) ]><!--> 
<html <?php language_attributes(); ?>> 
<!--<![endif]--> 
<head> 
<meta charset="<?php bloginfo('charset'); ?>" /> 
<meta name="viewport" content="width=device-width" /> 
<title><?php 
    /* 
    * Print the <title> tag based on what is being viewed. 
    */ 
    global $page, $paged; 

    wp_title('|', true, 'right'); 

    // Add the blog name. 
    bloginfo('name'); 

    // Add the blog description for the home/front page. 
    $site_description = get_bloginfo('description', 'display'); 
    if ($site_description && (is_home() || is_front_page())) 
     echo " | $site_description"; 

    // Add a page number if necessary: 
    if ($paged >= 2 || $page >= 2) 
     echo ' | ' . sprintf(__('Page %s', 'twentyeleven'), max($paged, $page)); 

    ?></title> 
<link rel="profile" href="http://gmpg.org/xfn/11" /> 
<link rel="stylesheet" type="text/css" media="all" href="<?php bloginfo('stylesheet_url'); ?>" /> 
<link rel="pingback" href="<?php bloginfo('pingback_url'); ?>" /> 
<!--[if lt IE 9]> 
<script src="<?php echo get_template_directory_uri(); ?>/js/html5.js" type="text/javascript"></script> 
<![endif]--> 
<?php 
    /* We add some JavaScript to pages with the comment form 
    * to support sites with threaded comments (when in use). 
    */ 
    if (is_singular() && get_option('thread_comments')) 
     wp_enqueue_script('comment-reply'); 

    /* Always have wp_head() just before the closing </head> 
    * tag of your theme, or you will break many plugins, which 
    * generally use this hook to add elements to <head> such 
    * as styles, scripts, and meta tags. 
    */ 
    wp_head(); 
?> 

<script type="text/javascript" src="/dw/wp-content/themes/child/scripts/galleria.js"></script> 
<script type="text/javascript" src="/dw/wp-content/themes/child/scripts/Java_Box.js"></script> 
<script type="text/javascript" src="/dw/wp-content/themes/child/scripts/resize-pdf.js"></script> 
</head> 

<body <?php body_class(); ?>> 
<div id="page" class="hfeed"> 
    <header id="branding" role="banner"> 
      <div class="logo" onclick="location.href='http://www.dwmu.co.uk';" style="cursor:pointer;"></div> 
        <div class="info">Make Up Artist</div> 

      <?php 
       // Check to see if the header image has been removed 
       $header_image = get_header_image(); 
       if (! empty($header_image)) : 
      ?> 
      <a href="<?php echo esc_url(home_url('/')); ?>"> 
       <?php 
        // The header image 
        // Check if this is a post or page, if it has a thumbnail, and if it's a big one 
        if (is_singular() && 
          has_post_thumbnail($post->ID) && 
          (/* $src, $width, $height */ $image = wp_get_attachment_image_src(get_post_thumbnail_id($post->ID), array(HEADER_IMAGE_WIDTH, HEADER_IMAGE_WIDTH))) && 
          $image[1] >= HEADER_IMAGE_WIDTH) : 
         // Houston, we have a new header image! 
         echo get_the_post_thumbnail($post->ID, 'post-thumbnail'); 
        else : ?> 
        <img src="<?php header_image(); ?>" width="<?php echo HEADER_IMAGE_WIDTH; ?>" height="<?php echo HEADER_IMAGE_HEIGHT; ?>" alt="" /> 
       <?php endif; // end check for featured image or standard header ?> 
      </a> 
      <?php endif; // end check for removed header image ?> 

      <?php 
       // Has the text been hidden? 
       if ('blank' == get_header_textcolor()) : 
      ?> 
       <div class="only-search<?php if (! empty($header_image)) : ?> with-image<?php endif; ?>"> 
       <?php get_search_form(); ?> 
       </div> 
      <?php 
       else : 
      ?> 
       <?php get_search_form(); ?> 
      <?php endif; ?> 

      <nav id="access" role="navigation"> 
       <h3 class="assistive-text"><?php _e('Main menu', 'twentyeleven'); ?></h3> 
       <?php /* Allow screen readers/text browsers to skip the navigation menu and get right to the good stuff. */ ?> 
       <div class="skip-link"><a class="assistive-text" href="#content" title="<?php esc_attr_e('Skip to primary content', 'twentyeleven'); ?>"><?php _e('Skip to primary content', 'twentyeleven'); ?></a></div> 
       <div class="skip-link"><a class="assistive-text" href="#secondary" title="<?php esc_attr_e('Skip to secondary content', 'twentyeleven'); ?>"><?php _e('Skip to secondary content', 'twentyeleven'); ?></a></div> 
       <?php /* Our navigation menu. If one isn't filled out, wp_nav_menu falls back to wp_page_menu. The menu assiged to the primary position is the one used. If none is assigned, the menu with the lowest ID is used. */ ?> 
       <?php wp_nav_menu(array('theme_location' => 'primary')); ?> 
      </nav><!-- #access --> 
    </header><!-- #branding --> 


    <div id="main"> 
+0

jQuery 라이브러리를로드하지 않습니다. JS 라이브러리 중 하나 (Galleria?)가 작동하려면 jQuery가 필요합니다. –

+0

jQuery 라이브러리를 포함해야합니다. 스크립트를 다운로드하여 스크립트 폴더에 저장하거나 Google cdn을 사용하십시오. https : //ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js –

+0

오류는 거의 설명이 필요하지 않습니다. 귀하의 질문은 무엇인가? –

답변

1

다음 스크립트 태그를 추가하십시오. 워드 프레스에서

<script type="text/javascript" src="/dw/wp-content/themes/child/scripts/galleria.js"> </script> 
<script type="text/javascript" src="/dw/wp-content/themes/child/scripts/Java_Box.js"> </script> 
<script type="text/javascript" src="/dw/wp-content/themes/child/scripts/resize-pdf.js"></script> 
+0

감사합니다. 계속 오류 메시지가 표시됩니다 ... 정규식이 잘못되었습니다 :/ – user1096057

+0

누락 된 다른 콘솔 로깅 정보가 있습니까? 당신은 코드에서 js 정규 표현식을 사용하는 것 같지 않습니다. 다른 js 라이브러리 중 하나에서 오류가 발생할 가능성이 있습니까? –

1

<script type="text/javascript" src="https://ajax.googleapis.com/ajax/libs/jquery/1.7.2/jquery.min.js"></script> 

, jQuery를 포함 할 수있는 좋은 방법은 그것을 대기 것입니다 :

wp_enqueue_script('jquery'); 

전에 wp_head()를 호출하는 것이 호출해야합니다.

+0

고맙습니다. 다음 오류 메시지가 계속 나타납니다 ... 정규식이 잘못되었습니다 :/ – user1096057

+0

게시 한 코드에 정규 표현식이 표시되지 않습니다. 이 오류의 출처를 찾을 수 있습니까? 명확하게 분류됩니다 –

+0

이것은 $ (" â €" ") .appendTo (". 아티스트 이름 ")를 참조있어 줄 수있는 큰 따옴표가있다 그 중간에있는 문자 – user1096057

관련 문제