Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
13 commits
Select commit Hold shift + click to select a range
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
16 changes: 16 additions & 0 deletions amp.css
Original file line number Diff line number Diff line change
Expand Up @@ -2675,6 +2675,17 @@ label.screen-reader-text {
opacity: 0.8;
}

.widget-entry-card-info {
display: flex;
flex-wrap: wrap;
align-items: center;
}

.widget-entry-card-comment {
font-size: 0.7em;
padding: 4px 2px 2px 2px;
}

.widget-entry-card-pv {
margin-left: 5px;
font-style: italic;
Expand Down Expand Up @@ -9615,6 +9626,11 @@ https://codepen.io/nxworld/pen/oLdoWb
margin-right: 18px;
}

.info-list-item-comment {
margin-left: -10px;
margin-right: 12px;
}

.info-list-item-categorys .entry-category {
padding: 1px 18px;
margin-right: 8px;
Expand Down
2 changes: 1 addition & 1 deletion blocks/dist/blocks.build.asset.php
Original file line number Diff line number Diff line change
@@ -1 +1 @@
<?php return array('dependencies' => array('lodash', 'react', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-keycodes', 'wp-primitives', 'wp-rich-text'), 'version' => '9170b8f56ec55d77b928');
<?php return array('dependencies' => array('lodash', 'react', 'react-jsx-runtime', 'wp-block-editor', 'wp-blocks', 'wp-components', 'wp-compose', 'wp-data', 'wp-editor', 'wp-element', 'wp-hooks', 'wp-i18n', 'wp-keycodes', 'wp-primitives', 'wp-rich-text'), 'version' => '00f20c3925f2a5f21758');
37,936 changes: 37,935 additions & 1 deletion blocks/dist/blocks.build.js

Large diffs are not rendered by default.

4 changes: 4 additions & 0 deletions blocks/src/block/info-list/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,10 @@
"modified": {
"type": "boolean",
"default": false
},
"comment": {
"type": "boolean",
"default": false
}
},
"example": {},
Expand Down
9 changes: 8 additions & 1 deletion blocks/src/block/info-list/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ import { THEME_NAME, CreateCategoryList } from '../../helpers';

export default function edit( props ) {
const { attributes, setAttributes, className } = props;
const { count, showAllCats, cats, caption, showFrame, showDivider, modified } =
const { count, showAllCats, cats, caption, showFrame, showDivider, modified, comment } =
attributes;

const classes = classnames( 'info-list-box', 'block-box', {
Expand Down Expand Up @@ -112,6 +112,13 @@ export default function edit( props ) {
setAttributes( { showDivider: isChecked } )
}
/>
<ToggleControl
label={ __( 'コメント数を表示する', THEME_NAME ) }
checked={ comment }
onChange={ ( isChecked ) =>
setAttributes( { comment: isChecked } )
}
/>
<ToggleControl
label={ __( '更新日順に並び替える', THEME_NAME ) }
checked={ modified }
Expand Down
1 change: 1 addition & 0 deletions blocks/src/block/info-list/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@ function render_block_cocoon_block_info_list($attributes, $content)
'frame' => $attributes['showFrame'] ? 1 : 0,
'divider' => $attributes['showDivider'] ? 1 : 0,
'modified' => $attributes['modified'] ? 1 : 0,
'comment' => $attributes['comment'] ? 1 : 0,
];

ob_start();
Expand Down
4 changes: 4 additions & 0 deletions blocks/src/block/new-list/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,10 @@
"author": {
"type": "string",
"default": ""
},
"comment": {
"type": "boolean",
"default": false
}
},
"example": {},
Expand Down
8 changes: 8 additions & 0 deletions blocks/src/block/new-list/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ export default function edit( props ) {
post_type,
taxonomy,
author,
comment,
} = attributes;

const classes = classnames( 'new-list-box', 'block-box', {
Expand Down Expand Up @@ -235,6 +236,13 @@ export default function edit( props ) {
setAttributes({ date: isChecked })
}
/>
<ToggleControl
label={__('コメント数を表示する', THEME_NAME)}
checked={comment}
onChange={(isChecked) =>
setAttributes({ comment: isChecked })
}
/>
</PanelBody>
<PanelBody title={ __( 'フィルタ', THEME_NAME ) } initialOpen={ false }>
<ToggleControl
Expand Down
1 change: 1 addition & 0 deletions blocks/src/block/new-list/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ function render_block_cocoon_block_new_list($attributes, $content)
'author' => $attributes['author'],
'offset' => $attributes['offset'],
'horizontal' => $attributes['horizontal'] ? 1 : 0,
'comment' => $attributes['comment'] ? 1 : 0,
];

$new_list_content = new_entries_shortcode($atts);
Expand Down
4 changes: 4 additions & 0 deletions blocks/src/block/popular-list/block.json
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@
"ex_cats": {
"type": "string",
"default": ""
},
"comment": {
"type": "boolean",
"default": false
}
},
"example": {},
Expand Down
6 changes: 6 additions & 0 deletions blocks/src/block/popular-list/edit.js
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,7 @@ export default function edit( props ) {
horizontal,
ex_posts,
ex_cats,
comment,
} = attributes;

const classes = classnames( 'popular-list-box', 'block-box', {
Expand Down Expand Up @@ -278,6 +279,11 @@ export default function edit( props ) {
checked={date}
onChange={(isChecked) => setAttributes({ date: isChecked })}
/>
<ToggleControl
label={__('コメント数を表示する', THEME_NAME)}
checked={comment}
onChange={(isChecked) => setAttributes({ comment: isChecked })}
/>
</PanelBody>
<PanelBody title={ __( 'フィルタ', THEME_NAME ) } initialOpen={ false }>
<ToggleControl
Expand Down
1 change: 1 addition & 0 deletions blocks/src/block/popular-list/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@ function render_block_cocoon_block_popular_list($attributes, $content)
'date' => $attributes['date'] ? 1 : 0,
'post_type' => $attributes['post_type'],
'horizontal' => $attributes['horizontal'] ? 1 : 0,
'comment' => $attributes['comment'] ? 1 : 0,
];

$popular_list_content = popular_entries_shortcode($atts);
Expand Down
26 changes: 26 additions & 0 deletions css/admin.css
Original file line number Diff line number Diff line change
Expand Up @@ -2914,6 +2914,15 @@ body.wp-admin {
font-size: 12px;
opacity: 0.8;
}
.admin-settings .demo .widget-entry-card-info {
display: flex;
flex-wrap: wrap;
align-items: center;
}
.admin-settings .demo .widget-entry-card-comment {
font-size: 0.7em;
padding: 4px 2px 2px 2px;
}
.admin-settings .demo .widget-entry-card-pv {
margin-left: 5px;
font-style: italic;
Expand Down Expand Up @@ -8883,6 +8892,10 @@ body.wp-admin {
.admin-settings .demo .info-list-item-date {
margin-right: 18px;
}
.admin-settings .demo .info-list-item-comment {
margin-left: -10px;
margin-right: 12px;
}
.admin-settings .demo .info-list-item-categorys .entry-category {
padding: 1px 18px;
margin-right: 8px;
Expand Down Expand Up @@ -11478,6 +11491,15 @@ body.wp-admin {
font-size: 12px;
opacity: 0.8;
}
.admin-settings .demo .widget-entry-card-info {
display: flex;
flex-wrap: wrap;
align-items: center;
}
.admin-settings .demo .widget-entry-card-comment {
font-size: 0.7em;
padding: 4px 2px 2px 2px;
}
.admin-settings .demo .widget-entry-card-pv {
margin-left: 5px;
font-style: italic;
Expand Down Expand Up @@ -17447,6 +17469,10 @@ body.wp-admin {
.admin-settings .demo .info-list-item-date {
margin-right: 18px;
}
.admin-settings .demo .info-list-item-comment {
margin-left: -10px;
margin-right: 12px;
}
.admin-settings .demo .info-list-item-categorys .entry-category {
padding: 1px 18px;
margin-right: 8px;
Expand Down
16 changes: 16 additions & 0 deletions css/entry-content.css
Original file line number Diff line number Diff line change
Expand Up @@ -4891,6 +4891,17 @@ label.screen-reader-text {
opacity: 0.8;
}

.widget-entry-card-info {
display: flex;
flex-wrap: wrap;
align-items: center;
}

.widget-entry-card-comment {
font-size: 0.7em;
padding: 4px 2px 2px 2px;
}

.widget-entry-card-pv {
margin-left: 5px;
font-style: italic;
Expand Down Expand Up @@ -5370,6 +5381,11 @@ https://codepen.io/nxworld/pen/oLdoWb
margin-right: 18px;
}

.info-list-item-comment {
margin-left: -10px;
margin-right: 12px;
}

.info-list-item-categorys .entry-category {
padding: 1px 18px;
margin-right: 8px;
Expand Down
38 changes: 32 additions & 6 deletions lib/html-forms.php
Original file line number Diff line number Diff line change
Expand Up @@ -1003,6 +1003,7 @@ function generate_popular_entries_tag($atts){
'post_type' => 'post',
'horizontal' => 0,
'action' => null,
'comment' => 0,
), $atts, 'generate_popular_entries_tag'));

//Swiperスクリプトコードを呼び出すかどうか
Expand Down Expand Up @@ -1052,7 +1053,6 @@ function generate_popular_entries_tag($atts){
} else {
$post_thumbnail_img = get_original_image_tag($no_thumbnail_url, $w, $h, 'no-image popular-entry-card-thumb-no-image widget-entry-card-thumb-no-image', '');
}

//スニペット表示
$snippet_tag = '';
//「タイトルを重ねた大きなサムネイル」の時はスニペットを表示させない
Expand Down Expand Up @@ -1085,7 +1085,15 @@ function generate_popular_entries_tag($atts){
<?php if ($entry_type != ET_LARGE_THUMB_ON): ?>
<?php echo $pv_tag; ?>
<?php endif ?>
<?php generate_widget_entry_card_date('popular', $post->ID, $display = $date); ?>
<?php do_action( 'widget_entry_card_date_before', 'popular', $post->ID); ?>
<div class="popular-entry-card-meta widget-entry-card-meta card-meta">
<div class="popular-entry-card-info widget-entry-card-info card-info">
<?php generate_widget_entry_card_date('popular', $post->ID, $display = $date);
if ($comment): ?>
<span class="popular-entry-card-comment widget-entry-card-comment card-comment post-comment-count"><span class="fa fa-comment-o comment-icon" aria-hidden="true"></span><?php echo get_comments_number( $post->ID ); ?></span>
<?php endif; ?>
Comment on lines +1092 to +1094
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] The indentation for the PHP opening tag on line 1091 and the comment span on line 1092 is inconsistent with the surrounding code. The if ($comment): statement and its content should align with the generate_widget_entry_card_date call above it for better readability.

Suggested change
if ($comment): ?>
<span class="popular-entry-card-comment widget-entry-card-comment card-comment post-comment-count"><span class="fa fa-comment-o comment-icon" aria-hidden="true"></span><?php echo get_comments_number( $post->ID ); ?></span>
<?php endif; ?>
if ($comment): ?>
<span class="popular-entry-card-comment widget-entry-card-comment card-comment post-comment-count"><span class="fa fa-comment-o comment-icon" aria-hidden="true"></span><?php echo get_comments_number( $post->ID ); ?></span>
<?php endif; ?>

Copilot uses AI. Check for mistakes.
</div>
</div>
</div><!-- /.popular-entry-content -->
<?php if ($entry_type == ET_LARGE_THUMB_ON): ?>
<?php echo $pv_tag; ?>
Expand Down Expand Up @@ -1145,6 +1153,7 @@ function generate_widget_entries_tag($atts){
'ex_posts' => null,
'ex_cats' => null,
'ordered_posts' => null,
'comment' => 0,
), $atts, 'generate_widget_entries_tag'));

//Swiperスクリプトコードを呼び出すかどうか
Expand Down Expand Up @@ -1322,6 +1331,8 @@ function generate_widget_entries_tag($atts){
'type' => $type,
'horizontal' => $horizontal,
'date' => $date,
'comment' => $comment,
'post_id' => get_the_ID(),
);

if ($snippet) {
Expand Down Expand Up @@ -1406,7 +1417,6 @@ function generate_widget_entry_card_date($prefix, $post_id = null, $display = fa
// クラスのON/OFFを制御するオプション
$display_class = $display ? '' : ' display-none';
?>
<?php do_action( 'widget_entry_card_date_before', $prefix, $post_id); ?>
<div class="<?php echo $prefix; ?>-entry-card-date widget-entry-card-date<?php echo $display_class; ?>">
<span class="<?php echo $prefix; ?>-entry-card-post-date widget-entry-card-post-date post-date"><span class="fa fa-clock-o" aria-hidden="true"></span><span class="entry-date"><?php echo get_the_time(get_site_date_format(), $post_id); ?></span></span><?php
//更新日の取得
Expand Down Expand Up @@ -1573,8 +1583,10 @@ function get_widget_entry_card_link_tag($atts){
'classes' => null,
'object' => 'post',
'object_id' => null,
'post_id' => null,
'horizontal' => 0,
'target' => null,
'comment' => null,
), $atts, 'get_widget_entry_card_link_tag'));

$class_text = null;
Expand Down Expand Up @@ -1647,12 +1659,22 @@ function get_widget_entry_card_link_tag($atts){
<div class="<?php echo $prefix; ?>-entry-card-title widget-entry-card-title card-title"><?php echo $title;?></div>
<?php if ($snippet): ?>
<div class="<?php echo $prefix; ?>-entry-card-snippet widget-entry-card-snippet card-snippet"><?php echo $snippet; ?></div>
<?php endif; ?>
<?php endif;
if (!is_widget_navi_entry_card_prefix($prefix)) {
do_action( 'widget_entry_card_date_before', $prefix, $post_id);
}
?>
<div class="<?php echo $prefix; ?>-entry-card-meta widget-entry-card-meta card-meta">
<div class="<?php echo $prefix; ?>-entry-card-info widget-entry-card-info card-info">
<?php
if (!is_widget_navi_entry_card_prefix($prefix)) {
generate_widget_entry_card_date($prefix, null, $display = $date);
} ?>

}
if ($comment): ?>
<span class="<?php echo $prefix; ?>-entry-card-comment widget-entry-card-comment card-comment post-comment-count"><span class="fa fa-comment-o comment-icon" aria-hidden="true"></span><?php echo get_comments_number(); ?></span>
<?php endif; ?>
Comment on lines +1673 to +1675
Copy link

Copilot AI Nov 12, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

[nitpick] Similar indentation inconsistency as in the popular entries function. The if ($comment): block should be indented consistently with the surrounding code structure for better maintainability.

Suggested change
if ($comment): ?>
<span class="<?php echo $prefix; ?>-entry-card-comment widget-entry-card-comment card-comment post-comment-count"><span class="fa fa-comment-o comment-icon" aria-hidden="true"></span><?php echo get_comments_number(); ?></span>
<?php endif; ?>
if ($comment): ?>
<span class="<?php echo $prefix; ?>-entry-card-comment widget-entry-card-comment card-comment post-comment-count"><span class="fa fa-comment-o comment-icon" aria-hidden="true"></span><?php echo get_comments_number(); ?></span>
<?php endif; ?>

Copilot uses AI. Check for mistakes.
</div>
</div>
</div><!-- /.entry-content -->
</div><!-- /.entry-card -->
</a><!-- /.entry-card-link -->
Expand Down Expand Up @@ -1828,6 +1850,7 @@ function generate_info_list_tag($atts){
'action' => null,
'post_type' => 'post',
'taxonomy' => 'category',
'comment' => 0,
), $atts, 'generate_info_list_tag'));

$args = array(
Expand Down Expand Up @@ -1894,6 +1917,9 @@ function generate_info_list_tag($atts){
<?php do_action('info_list_item_meta_before'); ?>
<div class="info-list-item-meta">
<span class="info-list-item-date"><?php echo $date; ?></span>
<?php if ($comment): ?>
<span class="info-list-item-comment post-comment-count"><span class="fa fa-comment-o comment-icon" aria-hidden="true"></span><?php echo get_comments_number(); ?></span>
<?php endif; ?>
<span class="info-list-item-categorys"><?php the_nolink_categories() ?></span>
</div>
</div>
Expand Down
6 changes: 6 additions & 0 deletions lib/shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,6 +56,7 @@ function new_entries_shortcode($atts) {
'ex_posts' => null,
'ex_cats' => null,
'ordered_posts' => null,
'comment' => 0,
), $atts, 'new_list'));

//countオプションに異常値が入っていた場合
Expand Down Expand Up @@ -113,6 +114,7 @@ function new_entries_shortcode($atts) {
'ex_posts' => $exclude_post_ids,
'ex_cats' => $exclude_cat_ids,
'ordered_posts' => $ordered_post_ids,
'comment' => $comment,
);
ob_start();
generate_widget_entries_tag($atts);
Expand Down Expand Up @@ -146,6 +148,7 @@ function popular_entries_shortcode($atts) {
'post_type' => 'post',
'horizontal' => 0,
'action' => null,
'comment' => 0,
), $atts, 'popular_list'));

//countオプションに異常値が入っていた場合
Expand Down Expand Up @@ -188,6 +191,7 @@ function popular_entries_shortcode($atts) {
'post_type' => $post_type,
'horizontal' => $horizontal,
'action' => $action,
'comment' => $comment,
);
ob_start();
generate_popular_entries_tag($atts);
Expand Down Expand Up @@ -998,6 +1002,7 @@ function get_info_list_shortcode($atts){
'action' => null,
'post_type' => 'post',
'taxonomy' => null,
'comment' => 0,
), $atts, 'info_list'));

//countオプションに異常値が入っていた場合
Expand All @@ -1022,6 +1027,7 @@ function get_info_list_shortcode($atts){
'action' => $action,
'post_type' => $post_type,
'taxonomy' => $taxonomy,
'comment' => $comment,
);
ob_start();
generate_info_list_tag($atts);
Expand Down
Loading