teratail header banner
teratail header banner
質問するログイン新規登録

質問編集履歴

1

ソースコードの前後を記入

2021/07/10 05:30

投稿

furetarou
furetarou

スコア0

title CHANGED
File without changes
body CHANGED
@@ -9,9 +9,39 @@
9
9
  ```
10
10
 
11
11
  ### 該当のソースコード
12
+ function start_el(&$ output、$ object、$ depth = 0、$ args = Array、$ current_object_id = 0)
13
+ ```ここに言語名を入力
14
+ // Extend WP's Walker class to properly navigate the category hierarchy...
15
+ class Simple_Archive_Category_Walker extends Walker {
16
+ // Variables needed by the WP Walker class.
17
+ var $tree_type = 'category';
18
+ var $db_fields = array ('parent' => 'parent', 'id' => 'term_id');
12
19
 
20
+ // Variables used by the Simple Archive plug-in.
21
+ var $done_post_ids = ' ';
22
+ var $comment_count = 0;
13
- ```ここに言語名を入力
23
+ var $post_count = 0;
24
+
25
+ // Output a new element (Category)...
14
- function start_el(&$ output、$ object、$ depth = 0、$ args = Array、$ current_object_id = 0)
26
+ function start_el(&$ output、$ object、$ depth = 0、$ args = Array、$ current_object_id = 0)
27
+ {
28
+ global $simple_archive_options;
29
+
30
+ $args = wp_parse_args($r);
31
+
32
+ // Only show category heading if there are posts to show; keep count of posts...
33
+ $posts_to_show = 0;
34
+
35
+ // Get posts for this category.
36
+ $posts = get_posts('category=' . $category->term_id . '&orderby=post_date&order=DESC&numberposts=9999');
37
+
38
+ // Build a list of the post IDs that will be shown.
39
+ foreach($posts as $post) {
40
+ setup_postdata($post);
41
+ if(!strpos($this->done_post_ids, '+' . $post->ID . '+') || $simple_archive_options['list_post_once'] != 'on') {
42
+ $posts_to_show++;
43
+ }
44
+ }
15
45
  ```
16
46
 
17
47
  ### 試したこと