반응형
Notice
Recent Posts
Recent Comments
Link
일 | 월 | 화 | 수 | 목 | 금 | 토 |
---|---|---|---|---|---|---|
1 | 2 | 3 | 4 | 5 | ||
6 | 7 | 8 | 9 | 10 | 11 | 12 |
13 | 14 | 15 | 16 | 17 | 18 | 19 |
20 | 21 | 22 | 23 | 24 | 25 | 26 |
27 | 28 | 29 | 30 |
Tags
- JPA
- GET
- 플러그인
- SEO
- useEffect
- @Repository
- Login
- linkedhastset
- 인텔리제이
- mergeattributes()
- db
- firebase
- 구글알고리즘
- 구글애널리틱스
- Polylang
- HttpSession
- ChatGPT
- 데이터베이스
- @Controller
- @Entity
- 리액트오류
- addallattributes()
- post
- @Query
- GA4
- set
- Thymeleaf
- 워드프레스
- router
- 구글
Archives
- Today
- Total
개발천재
플러그인 없이 워드프레스 테마에 JQuery 추가하기 본문
반응형
JQuery는 가장 일반적으로 사용되는 JavaScript의 라이브러리 중의 하나이다. 명확하고 간결한 라이브러리이며, 웹사이트의 HTML 또는 CSS 요소를 변경하기 위해 사용되는 강력한 스크립트 언어라고 할 수 있다. 크기가 비교적 작기 때문에 로딩 시간이 느려지지 않고 잘 작동한다.
JQuery는 워드프레스에서 제공하고 있지만 바로 사용할 수 있는 것은 아니다. 테마에 사용할 수 있도록 추가되어 있지 않다면 사용할 수 없다.
플러그인을 사용해서 JQuery를 설치할 수 있지만, 플러그인을 사용하지 않고 코드를 추가하는 것으로 JQuery를 설치할 수도 있다. 다만 테마를 업데이트하게 되면 아래 코드를 다시 추가해야 된다.
<head> 태그 뒤에 코드 삽입하여 JQuery 추가하기
<script src="https://code.jquery.com/jquery-3.5.1.slim.min.js" type="text/javascript"></script>
(or)
<script src="https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js" type="text/javascript"></script>
(or)
<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery-migrate/3.3.1/jquery-migrate.min.js" type="text/javascript"></script>
(or)
<script src="https://code.jquery.com/jquery-migrate-3.3.1.min.js" type="text/javascript"></script>
function.php 에 코드 삽입하여 JQuery 추가하기
function add_new_jquery ()
{
//https://ajax.googleapis.com/ajax/libs/jquery/3.5.1/jquery.min.js
wp_deregister_script ( 'jquery-core');
wp_register_script ( 'jquery-core', "https://code.jquery.com/jquery-3.5.1.min.js", array (), '3.5.1');
wp_deregister_script ( 'jquery');
wp_register_script ( 'jquery', "https://code.jquery.com/jquery-3.5.1.min.js", array (), '3.5.1');
wp_enqueue_script ( 'jquery');
}
add_action ( 'wp_enqueue_scripts', 'add_new_jquery');
반응형
'워드프레스' 카테고리의 다른 글
워드프레스 이미지 파일이 여러 개로 생성되는 이유 (0) | 2021.10.13 |
---|---|
워드프레스 리비전(Revision) 개수 제한/삭제하기 (1) | 2021.09.09 |
워드프레스 사이트 url에서 카테고리 슬러그 삭제하기 (2) | 2021.09.08 |
워드프레스 데이터베이스 기본 개념 이해하기 (0) | 2021.08.17 |
워드프레스를 써야하는 이유, 장점과 단점에 대해서 (0) | 2021.08.12 |