A couple days ago I twittered that I’d be share a Dynamic Most Popular Pages By Category Wordpress hack. 며칠 전 범주 Wordpress함으로써 해킹을 공유하는 동적 내가 가장 인기있는 페이지가 될 거라고 twittered. Its been in place on this blog for that time and I’ve noticed a decent improvement in the time people are spending on the site and the number of pages they visit. 그 자리에 그 시간에이 블로그에 있은 사람들이 사이트에 그들이 방문하는 페이지의 수를 소비하는 시간에 끝내주는 개선 나타났습니다.

Keep in mind, my increase is also a consequence of my categories being listed at the top of the page. 염두에 두십시오, 내 인상도 내 카테고리의 귀결되는 페이지의 상단에 나열되고있다. People click through it often. 그것을 통해 사람들을 자주 누릅니다. I use it as a method to filter traffic and get visitors exactly where they want to be. 트래픽을 필터링하는 방법으로 사용하고 방문자를 얻을 정확히 어디에 그들이되고 싶어요. Arguably, I need to go through some of my first posts and categorize them better, however, I’m sure many of you find yourself in the same position. 틀림없이, 나는 내 첫 번째 게시물의를 통과하고 그들을 더 잘 분류하지만, 저는 여러분 중에 많은 분들이 필요 해요 같은 입장에 자신을 찾으십시오.

Adding a categorical most popular pages on category pages will provide you some relief until you can do that yourself. 때까지 자기가 할 수있는 범주에 속하는 범주 페이지에서 가장 인기있는 페이지를 추가하면 일부 릴리프를 제공하는 것입니다. Either way, its still nice to have a another sorting method. 어느 쪽이든은 여전히 다른 정렬 방법이 되서 좋네요. And anything that helps the majority of your visitors improves the bottom line of most website’s goals. 그리고 아무것도 그 대부분의 웹사이트 방문자의 대부분은 도움이 목표의 하단 라인을 향상시킬 수있습니다.

Example 예를

Web Design Category Page: http://robmalon.com/category/web-design/ 웹 디자인 범주 페이지 : http://robmalon.com/category/web-design/

Plugin & Version Requirements 플러그인 및 버전 요구 사항

Wordpress.Com Stats - Wordpress.Com Stats is one of the best, and the least load intensive statistics tracker you can get for Wordpress. Wordpress.Com 통계 - 통계 Wordpress.Com 한 최선의, 그리고 당신이 Wordpress를위한 최소한의 부하 집중 통계 추적기 얻을 수있다. Why? 왜? Because Wordpress themselves hosts it! Wordpress 때문에 직접 호스트! See the graph to the right for an example of how it appears in your dashboard. 오른쪽 대시보드에 표시하는 방법의 예입에 대한 그래프를 참조하십시오. This is where the data is pulled from to create the popular posts list. 이 데이터는 어디에서 인기있는 게시물 목록을 만드는 방법을 발산하고있다.

Wordpress Popular Post - This “hack” is actually a modification to the Wordpress Popular Post Plugin . WordPress의 인기 포스트 -이 ""실제로 Wordpress 인기 포스트는 플러그인에 대한 수정이다 해킹. Perhaps they will update it with this functionality in a future release. 아마도 그들은 향후 릴리스에서이 기능을 함께 업데이 트됩니다.

Wordpress 2.6 - I’m using this on a Wordpress 2.6.x install. WordPress의 2.6 - Wordpress 2.6.x a 설치에이 사용하고있습니다. I’ve heard that the popular post plugin does not work on Wordpress 2.5, but that may be an isolated issue. 내가 인기 게시할 플러그인이 Wordpress 2.5에서 작동하지 않지만, 그 외딴 문제가있을 수있습니다 들었습니다. Give it a try and comment your results below. 그것을 시도하고, 아래의 결과를 언급주세요.

WPPP - Wordpress Popular Posts Modifications WPPP - WordPress의 인기 게시물 수정

You can see the code changes below, but here is a link to my wppp.php modifications . 당신이 여기에 아래의 코드를 변경 사항을 볼 수 있지만 내 wppp.php 개조에 대한 링크입니다. I modified the 1.3.4 version of Wordpress Popular Posts. 나는 Wordpress 1.3.4 버전으로 바뀌었 인기의 게시물입니다. I’ll try and keep this updated, but you may be able to make changes to future versions of the plugin (with my additions) by using something like winmerge to migrate new/old code 이 업데이 트 계속 노력 할게요, 그러나 당신은 플러그인의 향후 버전에 내 이미지 ()를 변경하실 수있습니다 새로운 / 낡은 코드로 마이 그 레이션 winmerge 같은 것을 사용하여

The wppp.php file we’re modifying here can be found in: /wp-content/plugins/wordpresscom-popular-posts/wppp.php (if the plugin is installed) 이 wppp.php 우리가 여기에서 찾을 수있어 파일 수정 : / wp-content/plugins/wordpresscom-popular-posts/wppp.php (플러그인)가 설치되어있다

  1. //Make changes to wppp.php version 1.3.4 and in this order for line numbers to be accurate
  2. //LINE 20 - ADD AFTER: ,’title_length’ => ‘0′
  3. , ‘by_category’ => ‘0′
  4. //LINE 61 - REPLACE: $howmany *= 2;
  5. $howmany *= 5 ;
  6. //LINE 87 STARTS WITH: $results = $wpdb->get_results("
  7. //CONTINUES TILL 94 WHICH ENDS WITH: } 전까지 //CONTINUES TILL 94 WHICH ENDS WITH: }
  8. REPLACE WITH : 교체 : REPLACE WITH :
  9. //RobMalon.com category hack
  10. $currentcat = $WPPP_defaults [ ‘by_category’ ] ;
  11. //Checks and toggle default query usage
  12. if ( is_numeric ( $opzioni [ ‘by_category’ ] ) && $opzioni [ ‘by_category’ ] > 0 ) {
  13. $results = $wpdb -> get_results ( "SELECT * FROM {$wpdb->posts} p LEFT OUTER JOIN wp_term_relationships r ON r.object_id = p.ID LEFT OUTER JOIN wp_terms t ON t.term_id = r.term_taxonomy_id WHERE p.id IN (" . implode ( ‘,’ , $id_list ) . ") AND p.post_type = ‘" . ( $opzioni [ ’show’ ] == ‘pages’ ? ‘page’ : ‘post’ ) . "’ AND t.term_id = ‘" . $opzioni [ ‘by_category’ ] . "’" ) ; 어디 피 $results = $wpdb -> get_results ( "SELECT * FROM {$wpdb->posts} p LEFT OUTER JOIN wp_term_relationships r ON r.object_id = p.ID LEFT OUTER JOIN wp_terms t ON t.term_id = r.term_taxonomy_id WHERE p.id IN (" . implode ( ‘,’ , $id_list ) . ") AND p.post_type = ‘" . ( $opzioni [ ’show’ ] == ‘pages’ ? ‘page’ : ‘post’ ) . "’ AND t.term_id = ‘" . $opzioni [ ‘by_category’ ] . "’" ) ; ON으로 T는 $results = $wpdb -> get_results ( "SELECT * FROM {$wpdb->posts} p LEFT OUTER JOIN wp_term_relationships r ON r.object_id = p.ID LEFT OUTER JOIN wp_terms t ON t.term_id = r.term_taxonomy_id WHERE p.id IN (" . implode ( ‘,’ , $id_list ) . ") AND p.post_type = ‘" . ( $opzioni [ ’show’ ] == ‘pages’ ? ‘page’ : ‘post’ ) . "’ AND t.term_id = ‘" . $opzioni [ ‘by_category’ ] . "’" ) ; = $results = $wpdb -> get_results ( "SELECT * FROM {$wpdb->posts} p LEFT OUTER JOIN wp_term_relationships r ON r.object_id = p.ID LEFT OUTER JOIN wp_terms t ON t.term_id = r.term_taxonomy_id WHERE p.id IN (" . implode ( ‘,’ , $id_list ) . ") AND p.post_type = ‘" . ( $opzioni [ ’show’ ] == ‘pages’ ? ‘page’ : ‘post’ ) . "’ AND t.term_id = ‘" . $opzioni [ ‘by_category’ ] . "’" ) ; ($ $results = $wpdb -> get_results ( "SELECT * FROM {$wpdb->posts} p LEFT OUTER JOIN wp_term_relationships r ON r.object_id = p.ID LEFT OUTER JOIN wp_terms t ON t.term_id = r.term_taxonomy_id WHERE p.id IN (" . implode ( ‘,’ , $id_list ) . ") AND p.post_type = ‘" . ( $opzioni [ ’show’ ] == ‘pages’ ? ‘page’ : ‘post’ ) . "’ AND t.term_id = ‘" . $opzioni [ ‘by_category’ ] . "’" ) ;
  14. } else {
  15. //note ID changed to upper case
  16. $results = $wpdb -> get_results ( "SELECT ID FROM {$wpdb->posts} WHERE id IN (" . implode ( ‘,’ , $id_list ) . ") AND post_type = ‘" . ( $opzioni [ ’show’ ] == ‘pages’ ? ‘page’ : ‘post’ ) . "’" ) ; = $results = $wpdb -> get_results ( "SELECT ID FROM {$wpdb->posts} WHERE id IN (" . implode ( ‘,’ , $id_list ) . ") AND post_type = ‘" . ( $opzioni [ ’show’ ] == ‘pages’ ? ‘page’ : ‘post’ ) . "’" ) ;
  17. }
  18. $valid_list = array ( ) ;
  19. foreach ( $results as $valid ) { $ foreach ( $results as $valid ) {
  20. $valid_list [ ] = $valid -> ID ; //note ID changed to upper case
  21. }
  22. //LINE 209 - ADD AFTER: $opzioni['title_length'] = $opzioni['title_length'] !== NULL ? $opzioni['title_length'] : $WPPP_defaults['title_length'];
  23. $opzioni [ ‘by_category’ ] = $opzioni [ ‘by_category’ ] !== NULL ? $opzioni [ ‘by_category’ ] : $WPPP_defaults [ ‘by_category’ ] ; $ $opzioni [ ‘by_category’ ] = $opzioni [ ‘by_category’ ] !== NULL ? $opzioni [ ‘by_category’ ] : $WPPP_defaults [ ‘by_category’ ] ;

Category Template Additions 카테고리 템플릿 추가

Now you need to add a function call to WPPP_show_popular_posts in your /wp-content/themes/[themename]/category.php file. 이제 귀하의 WPPP_show_popular_posts / wp-content/themes에 / [themename] / category.php 파일 함수 호출을 추가할 필요가있다. I’ve customized it in such a way that if there are less than 5 posts in a category, that it wont display a the popular category widget. 내가 이런식으로 개조 했어요 그 범주에서 미만인 경우에는 5 개 게시물, 그것이 인기있는 카테고리 위젯을 표시 불렀었있다. You can see it and easily change that functionality in the code you see below. 당신과 그 아래에 표시되는 코드에서 쉽게 볼 수있는 기능을 변경할 수있습니다.

  1. <?php if ( have_posts ( ) ) : ?>
  2. < h1 id = "cat_h1" > Category : <?php single_cat_title ( ) ? ></ h1 >
  3. <?php
  4. $numposts = $wp_query -> post_count ;
  5. if ( function_exists ( ‘WPPP_show_popular_posts’ ) && $numposts >= 5 ) { ?>
  6. < div id = "popularbycategory" >
  7. < h2 style = "padding:0;" > TOP 5 <?php single_cat_title ( ) ?> Articles </ h2 >
  8. < div class = "alreadyread" >
  9. <?php
  10. $category = get_the_category ( ) ;
  11. WPPP_show_popular_posts ( "show=posts&by_category={$category[0]->term_id}&title=&number=5&days=360&format=- <a href=’%post_permalink%’ title=’%post_title_attribute%’>%post_title%</a>" ) ;
  12. ?>
  13. </ div ></ div >
  14. <?php } ?>

General Popular Posts 일반적으로 인기 게시물

As a quick bonus, I thought I’d also give you the parameters of the general WPPP_show_popular_posts call that I’m using in the top left of all the pages on this site. 빠른 보너스로, 내가 또한 일반 WPPP_show_popular_posts의 매개 변수를 줘야 할 것 같아서 내가 가기에이 사이트의 모든 페이지의 왼쪽에 사용하고 있는데 전화를했다.

  1. <?php if ( function_exists ( ‘WPPP_show_popular_posts’ ) ) WPPP_show_popular_posts ( "show=posts&title_length=45&title=&number=6&days=360&format=- <a href=’%post_permalink%’ title=’%post_title_attribute%’>%post_title%</a>" ) ; ?>

Extending The Idea 아이디어를 연장

Note that the Popular By Categories hack I created was a rather quick fix. 카테고리 내가 만든 해킹을 참고하여 그 인기가 다소 빠른 수정했다. There’s more than one way to do it, and ways to make it more efficient/extendable. 이미 그것을 할 하나 이상의 방법이고, 방법을 좀 더 효율적 / 연장합니다. For example, pulling the popular categories for multiple delimited categories at once. 예를 들어, 한 번에 여러 개의 구분된 카테고리에 대한 인기있는 카테고리를 날리고있다. That would come in handy for a those that assign multiple categories to a post and want to display a “Most Popular Posts Within This Posts Categories”. 그 편리한에서 그 게시물에 여러 범주를 지정하고 "대부분의 인기가 표시하고자하는 게시물이 카테고리 내에서 게시물에 대해"올 것이라고했다. That’sa mouthful, and something I might do if its requested enough. 내가 요청한다면 충분히 할 수도 이것은 한입, 그리고 뭔가.

Leave a comment below with your results, examples, or questions. 귀하의 검색 결과, 예제, 또는 질문을 아래에 덧글을 남겨주세요.



Leave A Comment: 덧글을 남길 :

Comments RSS Feed 코멘트 RSS 피드

5 Minus 3 = 5 마이너스 3 =

Custom Theme by Rob Malon | Content & Design © 2008 - Rob Malon [dot] Com. 맞춤 테마 롭 런에 의해 | 콘텐츠 & 디자인 © 2008 - 롭 메일런 [도트] 그럼요. "));
"));