質問編集履歴
3
変更
test
CHANGED
File without changes
|
test
CHANGED
@@ -30,9 +30,9 @@
|
|
30
30
|
|
31
31
|
|
32
32
|
|
33
|
-
例えばユーザー追加したAさんが記事を書いたら著者名のところをAさんにBさんが
|
33
|
+
例えばユーザー追加したAさんが○○という記事を書いたら著者名のところをAさんにBさんが□□という記事を
|
34
34
|
|
35
|
-
Bさんにとしたいのです。
|
35
|
+
書いた記事ならBさんにとしたいのです。
|
36
36
|
|
37
37
|
|
38
38
|
|
2
追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -21,6 +21,86 @@
|
|
21
21
|
|
22
22
|
|
23
23
|
テーマはtwentyseventeenを使っています。
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
下記は新着情報の一覧と著者名、カテゴリー名、記事のタイトル、サムネイルを表示する物です。
|
28
|
+
|
29
|
+
ここの著者名をユーザーの追加で追加した名前を使って記事ごとに著者名を変えたいのです。
|
30
|
+
|
31
|
+
|
32
|
+
|
33
|
+
例えばユーザー追加したAさんが記事を書いたら著者名のところをAさんにBさんが書いた記事なら
|
34
|
+
|
35
|
+
Bさんにとしたいのです。
|
36
|
+
|
37
|
+
|
38
|
+
|
39
|
+
```ここに言語を入力
|
40
|
+
|
41
|
+
<!-- 新着記事表示 -->
|
42
|
+
|
43
|
+
<?php
|
44
|
+
|
45
|
+
$args = array(
|
46
|
+
|
47
|
+
'posts_per_page' => 14 // 表示件数の指定
|
48
|
+
|
49
|
+
);
|
50
|
+
|
51
|
+
$posts = get_posts( $args );
|
52
|
+
|
53
|
+
foreach ( $posts as $post ): // ループの開始
|
54
|
+
|
55
|
+
setup_postdata( $post ); // 記事データの取得
|
56
|
+
|
57
|
+
?>
|
58
|
+
|
59
|
+
|
60
|
+
|
61
|
+
<!-- カテゴリー名取得 -->
|
62
|
+
|
63
|
+
<?php
|
64
|
+
|
65
|
+
$category = get_the_category();
|
66
|
+
|
67
|
+
$cat_id = $category[0]->cat_ID;
|
68
|
+
|
69
|
+
$cat_name = $category[0]->cat_name;
|
70
|
+
|
71
|
+
$cat_slug = $category[0]->category_nicename;
|
72
|
+
|
73
|
+
?>
|
74
|
+
|
75
|
+
<!-- カテゴリー名取得 -->
|
76
|
+
|
77
|
+
|
78
|
+
|
79
|
+
<!-- imgTextBox -->
|
80
|
+
|
81
|
+
<div class="imgTextBox">
|
82
|
+
|
83
|
+
<p class="textP"><a href="<?php the_permalink(); ?>"><?php the_title(); ?></a><br><span class="postDate"><?php echo get_the_date( $format, $post ); ?></span><span class="writeName"><?php the_author(); ?></span><span class="catName"><?php echo $cat_name; ?></span></p>
|
84
|
+
|
85
|
+
<p class="imgP"><a href="<?php the_permalink(); ?>"><?php the_post_thumbnail('thumbnail'); ?></a></p>
|
86
|
+
|
87
|
+
</div>
|
88
|
+
|
89
|
+
<!-- imgTextBox -->
|
90
|
+
|
91
|
+
|
92
|
+
|
93
|
+
<?php
|
94
|
+
|
95
|
+
endforeach; // ループの終了
|
96
|
+
|
97
|
+
wp_reset_postdata(); // 直前のクエリを復元する
|
98
|
+
|
99
|
+
?>
|
100
|
+
|
101
|
+
<!-- 新着記事表示 -->
|
102
|
+
|
103
|
+
```
|
24
104
|
|
25
105
|
|
26
106
|
|
1
追加
test
CHANGED
File without changes
|
test
CHANGED
@@ -21,3 +21,53 @@
|
|
21
21
|
|
22
22
|
|
23
23
|
テーマはtwentyseventeenを使っています。
|
24
|
+
|
25
|
+
|
26
|
+
|
27
|
+
試したこと
|
28
|
+
|
29
|
+
---
|
30
|
+
|
31
|
+
```ここに言語を入力
|
32
|
+
|
33
|
+
<?php if ( is_singular() && get_the_author_meta( 'description' ) && is_multi_author() ) : // If a user has filled out their description and this is a multi-author blog, show a bio on their entries. ?>
|
34
|
+
|
35
|
+
<div class="author-info">
|
36
|
+
|
37
|
+
<div class="author-description">
|
38
|
+
|
39
|
+
<h3><?php the_author(); ?>について</h3>
|
40
|
+
|
41
|
+
<div class="author-avatar">
|
42
|
+
|
43
|
+
<?php
|
44
|
+
|
45
|
+
$author_bio_avatar_size = apply_filters( 'twentytwelve_author_bio_avatar_size', 68 );
|
46
|
+
|
47
|
+
echo get_avatar( get_the_author_meta( 'user_email' ), $author_bio_avatar_size );
|
48
|
+
|
49
|
+
?>
|
50
|
+
|
51
|
+
</div><!-- .author-avatar -->
|
52
|
+
|
53
|
+
<p><?php the_author_meta( 'description' ); ?></p>
|
54
|
+
|
55
|
+
<div class="author-link">
|
56
|
+
|
57
|
+
<a href="<?php echo esc_url( get_author_posts_url( get_the_author_meta( 'ID' ) ) ); ?>" rel="author">
|
58
|
+
|
59
|
+
<?php the_author(); ?>の全ての投稿を表示する
|
60
|
+
|
61
|
+
</a>
|
62
|
+
|
63
|
+
</div><!-- .author-link -->
|
64
|
+
|
65
|
+
</div><!-- .author-description -->
|
66
|
+
|
67
|
+
</div><!-- .author-info -->
|
68
|
+
|
69
|
+
<?php endif; ?>
|
70
|
+
|
71
|
+
```
|
72
|
+
|
73
|
+
こちらを試してみましたが何も表示されませんでした。
|