Posted in: 게시 :
616 views 616 조회
Please note: This page was originally written in English. 참고 사항 :이 페이지는 원래 영어로 작성된합니다.
The original post can be viewed 게시물의 원래으로 볼 수있습니다 here 여기에 . 합니다.
Please note: This page was originally written in English.
The text has been translated using an online service such as Google or Babelfish.
The original post can be viewed here.
This is the very first post in the 이것은 매우 첫 번째 게시물의 30 Wordpress Hacks in 30 Days Series 30 wordpress hacks에서 30 일 동안 시리즈 !
If you use Wordpress - then this is a series you will want to bookmark right now! wordpress를 사용하는 경우 - 그렇다면 이것은 시리즈를 원할 것입니다 책갈피 지금 당장! You might even want to subscribe by email at the top of the page. 구독 신청도하고 싶지 수있습니다 상단에있는 페이지를 이메일로합니다. If you’re like me your sick and tired of googling the crap out of the web trying to find easy ways to hack and customize your Wordpress blog or web site. 나 같은 경우에는 이제 진절머리가 인터넷 검색을 귀하의 웹 그 쓰레기 아웃 간단한 방법을 찾으려고 노력하고 wordpress 블로그 또는 웹 사이트를 해킹, 사용자 정의하십시오. I’m going to give you a very useful and easy to perform Wordpress hack every day for a month! 나는 당신에게 매우 유용하고 쉬운 wordpress 해킹을 수행 한 달 동안 매일 매일! I think that it’s easier to do something like this than write a humongous post with more information than you’ll never read or digest in one sitting. 생각하는 게 나을 것보다 이런 일을 할만한 게시물을 굉장하게 쓰기 읽기 또는 다이제스트보다 더 많은 정보를 한 당신은 절대 앉아있습니다. Instead I’m going to give you one very simple and easy task to do each and every day. 대신에 나는 당신에게 아주 간단하고 쉽게 작업을 할 각각의 그리고 매일합니다. Depending on your skill level, you may or may not want to take a look at last week’s post 귀하의 기술 수준에 따라, 당신을하지 않을 수도있습니다 게시물을보고 지난 주 How to Create Your Own Wordpress Theme 자신의 wordpress 테마를 만드는 방법을 . 합니다.
Wordpress Hack #1 - query_posts wordpress 해킹 # 1 - query_posts
Today in our very first Wordpress Hack in our 30-day “Hack-a-thon” we’re going to learn about the Wordpress “template tag” query_posts. 오늘날 우리의 첫 번째 wordpress 해킹의 30 - 일 "해킹 - - thon"우리는가는 wordpress에 대한 자세한 내용은 "템플릿 태그"query_posts합니다. You can 하실 수있습니다 read about query_posts in the Wordpress Codex here 여기에 wordpress 사본을 읽어 query_posts . 합니다. To use any of these examples you must place the PHP code snippet before “the loop”. 이러한 사례 중 하나를 사용에 코드의 발췌 문장 앞에 배치해야합니다 "루프"합니다. If you don’t know what “the loop” is, just follow the link in the previous paragraph to create your own wordpress theme for an explanation. 뭔지 모르하는 경우 "루프"는, 이전 단락에있는 링크를 따라가기만하면 자신의 wordpress 주제에 대한 설명을 만들 수있습니다. Each and every code snippet can used any any page that uses “the loop”, such as your index.php, category.php, archive.php, tag.php, or search.php. 각 코드 발췌 문장을 사용하는 모든 페이지를 사용한 적이있다 "는 루프",와 같은 귀하의 index.php, category.php, archive.php, tag.php, 또는 search.php합니다.
Exclude posts that belong to a category 게시물을 제외의 범주에 속하는
Maybe you don’t want posts from a certain category showing up on your index or another archive page. 아마도 특정 범주 게시물을하지 않으 귀하의 색인이나 다른 아카이브 페이지에 표시합니다. You could even use this to keep certain categories from showing in search results if you needed to. 이것을 사용할 수도 특정 카테고리의 보관이 필요하면 검색 결과를 표시합니다. You need to know your category “ID” to do this, just retrieve it from your dashboard under “Manage->Categories”, and the “-1″ with your category ID# like this… 귀하의 범주를 알고해야합니다 "번호"를 수행하려면 대시보드 아래에서 검색할 수 단지 "관리 -> 카테고리", 그리고 "-1"을 분류 번호 # 이렇게…
<?php query_posts('cat=-1'); ?> <함수 query_posts ( '고양이 =- 1');?> You can exclude multple categories like this… 이 같은 카테고리를 제외 multple하실 수있습니다…
<?php query_posts("cat=-1,-2,-3"); ?> <함수 query_posts ( "고양이 =- 1, -2, -3");?> Retrieve a Post or Page 게시물을 게시하거나 페이지를 검색할
To retrieve a particular post you can either call it by ID (listed in your dashboard) or it’s slug like this (use one line of code or the other, not both)… 특정 게시물을 검색하여 통화하실 수있습니다 신분증 (에 나와있는 '대시보드') 또는 그것의 민달팽이 이렇게 (한 라인의 코드를 사용하거나 다른이 아니라 둘 다)…
<?php query_posts('p=1'); //using post id query_posts('name=first-post'); //using post slug ?> <함수 query_posts ( 'p = 1'); / / 게시물 번호를 사용하여 query_posts ( '이름 = 첫 번째 - 포스트'); / /를 사용하여 게시물 민달팽이?> You can do the same thing to retrieve pages as well like this… 같은 작업을 수행할 수있습니다 페이지를 검색도 이렇게…
<?php query_posts('page_id=7'); //retrieves page 7 only query_posts('pagename=about'); //retrieves the about page only ?> <함수 query_posts ( 'page_id = 7'); / / 7 페이지의 검색에만 query_posts ( '페이지뷰 = 회사'); / /를 검색 페이지에 관하여 전용?> When you use those examples it retrieves the entire post. 이 예제를 사용하는 경우 게시물이 전체를 검색합니다. When you are notorious for writing extremely long posts (like I am) you may only want to get a partial post with the “read more” link. 아주 긴 게시물을 작성하는 경우 많기로 유명합니다 (예 : 나는)의 일부를 원한다면 수 밖에 없을 것입니다 포스트는 "자세히보기"링크를합니다. This is especialy useful if you’re going ot feature certain posts on your index or other pages. 이것은 특히 유용합니다 ot 기능을 특정 게시물에 갈거면 귀하의 색인이나 다른 페이지를합니다. Here’s the code for that… 여기에 대한 코드를 표시하는…
<?php query_posts('p=5'); //get post with id of 5 global $more; $more = 0; //gets partial post with read more link ?> <함수 query_posts ( 'p = 5'); / / 게시물을 번호의 5 글로벌 달러 더 많은; $ 더 많은 = 0; / / 제 부분적인 게시물을 읽고 더 많은 링크가 표시됩니까?> You know that you can create pages, and you can also create “child pages” like I have on ths site. 아시는 페이지를 작성하실 수있습니다, 그리고 만들 수있습니다 "하위 페이지에"난 ths 사이트에 미칠 영향은?합니다. I have a parent page called “series”, and then all the individual series index pages are children of that page. 나는 부모 페이지를 불리는 "시리즈"를 입력한 다음의 모든 개별 시리즈 인덱스 페이지는 해당 페이지의 자녀합니다. If you want to get a child page - that’s possible as well, but you can’t call it by id - you have to call it by double-slug as in the example below (parent slug slash child slug). 을 받기를 원한다면 아이를 페이지 - 그게 가능한 자, 그러나 그것을 호출할 수없습니다 번호 - 당신은 그것을 두 번 - 민달팽이로에게 전화 아래 예제에서 (부모 자녀 민달팽이 민달팽이 슬래시).
<?php query_posts('pagename=parent/child'); ?> <함수 query_posts ( '페이지뷰 = 부모 / 자식');?> Retrieve Post by Certain Authors 게시물을 검색할 특정 저자
If your blog has multiple authors you can retrive them by name or author id like this… 귀하의 블로그에 여러 개의 저자하실 수있습니다 그들의 이름을 포획 또는 저자 번호 이렇게…
<?php query_posts('author_name=John'); query_posts('author=3'); ?> <함수 query_posts ( 'author_name = 존'); query_posts ( '저자 = 3');?> Retrieve Every Single Post 모든 단일 게시물 검색
Maybe you want to make some kind of an archive page or sitemap. 아마도 당신 만들려는 어떤 종류의 아카이브 페이지 또는 사이트 맵합니다. Whether or not you create a page with this query of course depends on how many posts you really have, but inserting this code before the loop will list ever post you have all on one page. 한 페이지를 작성할지 여부에 따라 달라집니다 물론 해당 검색어와 얼마나 많은 게시물을 정말로 있지만,이 코드를 삽입하기 전에이 목록 루프가 모두 한 페이지에 게시물을 적합니다. While the code below shows all posts on one page, you can change the “-1″ to just 1 post, or 5, or 10, or however many posts you want to display. 모든 게시물을 표시하는 동안 한 페이지에 아래의 코드를 변경할 수있습니다 "-1"을 단지 1 개의 게시물, 또는 5, 또는 10, 또는 그러나 많은 게시물을 표시하려는합니다.
<?php query_posts('posts_per_page=-1'); ?> <함수 query_posts ( 'posts_per_page =- 1');?> Change the Order or Sequence of Posts 게시물의 주문을하거나 순서를 변경
By default a Wordpress blog shows you posts in a journal fashion or reverse date order. 기본적으로 wordpress 블로그에 게시물을 보여줍니다 저널 패션이나 반전 날짜 순서합니다. You could choose to instead sort your posts by author or title like this. 게시물을 선택하여 정렬할 수있습니다 대신 저자 또는 제목 이렇게합니다. You could use either the author or title lines. 저자 또는 제목 라인 중 하나를 사용할 수있습니다.
<?php query_posts('orderby=author'); query_posts('orderby=title'); ?> <함수 query_posts ( '정렬 = 저자'); query_posts ( '정렬 = 제목');?> Using “orderby” there are many different parameters that you can use like these… 사용하고 "정렬"지금은 같이하는 데 사용할 수있는 여러 매개 변수를…
* orderby=author * 출처 = 저자
* orderby=date * 출처 = 날짜
* orderby=category * 출처 = 분류
* orderby=title * 출처 = 제목
* orderby=modified * 출처 =으로 바뀌었습니다
* orderby=menu_order * 출처 = menu_order
* orderby=parent * 출처 = 부모
* orderby=ID * 출처 = 번호
* orderby=rand * 출처 = 랜드
Retrieve a Post by Time Period 게시물을 검색하는 기간을
There are many different ways to consruct a query to retrieve certain posts based by date only. 이미 많은 다른 방법을 consruct 특정 게시물을 기반으로하는 쿼리를 검색할 날짜에만합니다. Here’sa way to get them for a day of the month… 다음은 그들을 하루를 얻는 방법이 달의…
<?php query_posts('day=15'); //all posts on the 15th ?> <함수 query_posts ( '하루 = 15'); / / 모든 게시물은 15?> You could also get them for the current month and year with a query like this… 그들은 현재 수도있습니다 달 및 연도를 쿼리를 이렇게…
<?php $current_month = date('m'); ?> <?php $current_year = date('Y'); ?> <?php query_posts("cat=22&year=$current_year&monthnum=$current_month&order=ASC"); ?> <? $ current_month = 날짜 ( 'm');?> <? $ current_year = 날짜 ( '그리고');?> <함수 query_posts ( "고양이 = 22 & 년 = $ current_year & monthnum = $ current_month & 주문 = 오름차순"); ?> Retrieve Posts based on Tags 태그를 기반으로 게시물을 검색할
You can retrieve posts for a specific tag or tags like this (use one line of code at a time only). 게시물을 검색하실 수있습니다 또는 태그를 특정 태그를 이렇게 (한 라인의 코드를 사용을 한 번에에 한함). The first line retrieves posts with a particular tag, the second line is the format for getting posts for multiple tags, but the third line is for getting posts that were tagged in multiple categories. 첫 번째 행은 특정 태그를 통해 게시물을 검색, 두 번째 라인은 점점 게시물에 대한 형식은 여러 개의 태그,하지만 세 번째 라인은이 태그가 포함된 게시물을 벗게하기 위해서 여러 범주합니다. In other words the second line will retrieve all posts tagged as bread all posts tagged as baking. 즉, 태그가 포함된 모든 게시물을 검색하게 될 두 번째 줄에 태그가 포함된 모든 게시물로 빵 굽기로합니다. But the third line will get only posts tagged in bread and baking and recipe. 하지만 세 번째 라인은 태그가 포함된 게시물을 얻으려면 빵 굽기와 요리법을합니다.
<?php query_posts('tag=cooking'); query_posts('tag=bread,baking'); query_posts('tag=bread+baking+recipe'); ?> <함수 query_posts ( '태그 = 요리'); query_posts ( '태그 = 빵, 굽기'); query_posts ( '태그 = 빵 + 굽기 + 요리법');?> I hope this helps you do a little Wordpress “theme hacking” and customize your blog. 이게 도움이 되었으면 좋겠하지 조금 wordpress "주제 해킹"와 블로그를 사용자 정의합니다. If you have any questions about query_posts please comment now, and we’ll see your tomorrow for the next hack! query_posts에 대한 기타 문의 사항이 있으면 코멘트를하시기 바랍니다 현재, 그리고 내일에 대한 우리의 다음 해킹 참조하십시오!
Tags: 태그 : blog-help 블로그 - 도움말 , tutorial 튜토리얼 , wordpress-hacks wordpress - hacks






















April 15th, 2008 at 12:08 am 2008년 4월 15일에서 오전 12시 8분
I had actually been looking for the one about authors. 나는 사람에 대하여 사실은 저자를 찾고있습니다.
thanks a lot, it been a big help. 감사합니다, 그것 큰 도움이되었습니다.
Mark Wilson’s last blog post.. 마크 윌슨의 마지막 블로그 게시물 .. I hate the word “niche†œnicheâ이라는 단어 싫어 â € €
April 15th, 2008 at 9:04 am 2008년 4월 15일에서 오전 9시 4분
Loving the idea even though this one is sort of irrelevant for me, cannot wait for the rest. 사랑의 개념이 비록 종류의 관련성이없는 하나는 나를 위해, 나머지는 기다릴 수 없다.
April 28th, 2008 at 10:41 pm 2008년 4월 28일에서 오후 10시 41분
Okay… as a wordpress newbie (but someone who chose to dive head-first into WP development… silly me) I can’t tell you how much I value this series that you’re doin! 좋아 wordpress 초보자로서… (그러나 머리 - 첫 번째에있는 사람을 선택 백린 개발을 위해 잠수… 바보 같은 날) 말할 수 없어요 값이 시리즈를 얼마나 잘하고있어! Once I finally get my blog up and running, I’m going to have to toss out a thank-you for helping me so much! 내 블로그 일단 설치하고 실행 마침내, 나는 누군가에게 감사해야 할 것 - 당신을 던지기 수 있도록 도와주고 정말 감사 해요!
April 29th, 2008 at 7:59 am 2008년 4월 29일에서 오전 7시 59분
@Erika - glad to help! @ erika - 기꺼이 도와주세요! I love comments like this, because it means I made the right decision in starting this series… 사랑 의견이 이렇게 내가 만든 의미가 올바른 결정을하기 때문에이 시리즈 시작…