質問編集履歴
1
ソースコードを1行から全体のコードに変更しました。
test
CHANGED
File without changes
|
test
CHANGED
@@ -16,11 +16,51 @@
|
|
16
16
|
### 該当のソースコード
|
17
17
|
|
18
18
|
```ここに言語を入力
|
19
|
+
<section class="news">
|
20
|
+
<div class="news-area">
|
21
|
+
<h2>ブログ</h2>
|
22
|
+
<div class="articles">
|
23
|
+
<?php $posts = get_posts(array('post_type' => 'post', 'numberposts' => 3, 'orderby' => 'date', 'order' => 'DESC')); ?>
|
24
|
+
<?php foreach ($posts as $post) : ?>
|
25
|
+
<?php
|
26
|
+
$id = $post->ID;
|
27
|
+
$title = $post->post_title;
|
28
|
+
if(mb_strlen($title, 'UTF-8') > 32){
|
29
|
+
$titlestr = mb_substr($title, 0, 32).'.';
|
30
|
+
} else {
|
31
|
+
$titlestr = $post->post_title;
|
32
|
+
}
|
33
|
+
$imageurl = get_the_post_thumbnail_url($id, 'large');
|
34
|
+
$category = get_the_category()[0];
|
35
|
+
?>
|
36
|
+
<div class="article article-area match-height">
|
37
|
+
<figure>
|
38
|
+
<div class="img-wrap">
|
39
|
+
<img alt="<?php echo $title ?>" src="<?php echo $imageurl; ?>">
|
40
|
+
</div>
|
41
|
+
<figcaption>
|
42
|
+
<div class="cat-area">
|
43
|
+
<p><?php echo $category->cat_name; ?></p>
|
44
|
+
</div>
|
45
|
+
<h3><?php echo $titlestr; ?></h3>
|
46
|
+
<div class="date-area">
|
19
|
-
<p><time datetime="<?php echo the_time('Y-m-d'); ?>" itemprop="datePublished"><?php echo the_time('Y/m/d'); ?></time></p>
|
47
|
+
<p><time datetime="<?php echo the_time('Y-m-d'); ?>" itemprop="datePublished"><?php echo the_time('Y/m/d'); ?></time></p>
|
48
|
+
</div>
|
49
|
+
</figcaption>
|
50
|
+
<a href="<?php echo get_permalink($id); ?>"></a>
|
51
|
+
</figure>
|
52
|
+
</div>
|
53
|
+
<?php endforeach; ?>
|
54
|
+
</div>
|
55
|
+
<div class="link-button link-icon">
|
56
|
+
<a href="<?php echo home_url(); ?>/blog/">もっと見る</a>
|
57
|
+
</div>
|
58
|
+
</div>
|
59
|
+
</section>
|
20
60
|
```
|
21
61
|
|
22
62
|
```ここに言語を入力
|
23
|
-
echo the_time('Y/m/d');
|
63
|
+
<p><time datetime="<?php echo the_time('Y-m-d'); ?>" itemprop="datePublished"><?php echo the_time('Y/m/d'); ?></time></p>
|
24
64
|
```
|
25
65
|
|
26
66
|
|