Skip to content

Commit

Permalink
メイド・イン・ヘブンスキンのアップデート v2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
yhira committed Apr 23, 2024
1 parent 747eb71 commit fa645aa
Show file tree
Hide file tree
Showing 7 changed files with 292 additions and 3 deletions.
63 changes: 61 additions & 2 deletions skins/skin-made-in-heaven/assets/css/original.css
Expand Up @@ -299,6 +299,10 @@
}
}

.no-radius.timeline-box .timeline-item:before {
border-radius: 0!important;
}


/*******************************************************************************
** コピーボタン
Expand Down Expand Up @@ -422,11 +426,66 @@ pre {
*******************************************************************************/

.is-style-hvn-tab-line .tab-label-group .tab-label {
border-bottom:1px solid var(--border-color);
border-bottom: 1px solid var(--border-color);
}

.is-style-hvn-tab-line .tab-label-group .tab-label.is-active {
background-color: transparent;
border-bottom: 2px solid var(--main-color);
color:var(--main-color);
color: var(--main-color);
}


/*******************************************************************************
** ブログカード
*******************************************************************************/

.is-style-hvn-text .blogcard-label,
.is-style-hvn-text .blogcard-thumbnail,
.is-style-hvn-text .blogcard-footer {
display: none;
}

.is-style-hvn-text .blogcard-wrap.a-wrap {
align-items: center;
display: flex;
gap: 5px;
margin: 0;
}

.is-style-hvn-text .blogcard {
border: 0;
padding: 0;
}

.is-style-hvn-text .blogcard-content {
padding: 0;
}

.is-style-hvn-text .blogcard-title {
color: #1e88e5;
font-weight: normal;
text-decoration: underline;
}

.is-style-hvn-text .blogcard-title:hover {
color: #e53900;
}

.is-style-hvn-text .blogcard-wrap:before {
border: 1px solid var(--cocoon-text-color);
border-radius: 100%;
content: '\f0c1';
flex-shrink: 0;
font-family: "Font Awesome 5 Free";
font-weight: 900;
display: grid;
height: 20px;
place-content: center;
font-size: 14px;
width: 20px;
}

.is-style-hvn-text .internal-blogcard-wrap:before {
content: '\f15c';
}
6 changes: 6 additions & 0 deletions skins/skin-made-in-heaven/assets/js/block.js
Expand Up @@ -34,3 +34,9 @@ wp.blocks.registerBlockStyle('cocoon-blocks/tab', {
name: 'hvn-tab-line',
label: '下線'
});


wp.blocks.registerBlockStyle('cocoon-blocks/blogcard', {
name: 'hvn-text',
label: 'テキスト'
});
29 changes: 29 additions & 0 deletions skins/skin-made-in-heaven/lib/hook-cocoon.php
Expand Up @@ -315,3 +315,32 @@ function breadcrumbs_root_text_custom(){
echo '<div class="ribbon ribbon-top-left ' . $class[0] . '"></div>';
}
});


//******************************************************************************
// カラーパレット追加
//******************************************************************************
add_filter('block_editor_color_palette_colors', function($colors) {
$main_color = get_theme_mod('hvn_main_color_setting', HVN_MAIN_COLOR);
$rgb = hvn_color_mix_rgb($main_color, 0.15);
$hover_color = $rgb['hex'];

$add_colors = array(
array('name' => __('スキンカラー1' , THEME_NAME), 'slug' => 'hvn-main-color' , 'color' => $main_color),
array('name' => __('スキンカラー2' , THEME_NAME), 'slug' => 'hvn-hover-color', 'color' => $hover_color),
);
$colors = array_merge($colors, $add_colors);

return $colors;
});


//******************************************************************************
// SNSシェアコメントボタン表示
//******************************************************************************
add_filter('is_comment_share_button_visible', function($res, $option) {
if (!is_single_comment_visible()) {
$res = false;
}
return $res;
}, 10, 2);
106 changes: 106 additions & 0 deletions skins/skin-made-in-heaven/lib/hook-wp.php
Expand Up @@ -524,3 +524,109 @@
$block_content = preg_replace('/class="(inline-button)/', "class=\"$btn_circle $btn_shine $1", $block_content);
return $block_content;
});


//******************************************************************************
// コメントフォーム追加
//******************************************************************************

// コメントフォーム追加
add_action('comment_form_field_comment', function($content) {
$icon = 3;
$html = null;

if (get_theme_mod('hvn_comment_setting') && is_user_logged_in()){
for ($i=1; $i<=$icon; $i++) {
$checked = null;
if ($i == 1) {
$checked = 'checked';
}
$img = get_theme_mod("hvn_comment_img{$i}_setting");
if ($img) {
$url = wp_get_attachment_url($img);
$html .= <<< EOF
<div class="hvn-comment-icon">
<figure><img src="{$url}"></figure>
<input type="radio" name="post-icon" value="{$i}" {$checked}>
</div>
EOF;
}
}
if ($html) {
$html = "<label>アイコン</label><div class=hvn-comment>{$html}</div>";
}
}

return $html . $content;
});


// カスタムフィールド出力
add_action('comment_post', function($comment_id) {
if (get_theme_mod('hvn_comment_setting') && is_user_logged_in()) {
$post_icon = esc_attr($_POST['post-icon']);
add_comment_meta($comment_id, 'post-icon', $post_icon, true);
}
});


// コメントメタカスタムフィールド追加
add_action('add_meta_boxes_comment', function() {
add_meta_box('hvn-comment-title', 'カスタムフィールド' , 'comment_meta_post_icon', 'comment', 'normal', 'high');
});


function comment_meta_post_icon($comment) {
$post_icon = get_comment_meta($comment->comment_ID, 'post-icon', true);

$html = <<<EOF
<p>
<label for="post-icon">アイコン番号:</label>
<input type="text" name="post-icon" value="{$post_icon}" class="widefat" />
</p>
EOF;

echo $html;
}


// コメントを編集カスタムフィールド更新
add_action('edit_comment', function($comment_id) {
if (isset($_POST['post-icon'])) {
update_comment_meta($comment_id, 'post-icon', esc_attr($_POST['post-icon']));
}
});


// コメント一覧にカスタムフィールド追加
add_filter('manage_edit-comments_columns', function($columns) {
$columns['post-icon'] = "アイコン番号";

return $columns;
});


add_action('manage_comments_custom_column', function($column_name, $comment_id) {
if ($column_name == 'post-icon') {
$post_icon = get_comment_meta($comment_id, 'post-icon', true);
echo esc_attr($post_icon);
}
},10, 2);


// アバター変更
add_filter('get_avatar' , function($avatar, $comment) {
if (get_theme_mod('hvn_comment_setting')) {
if (!is_admin() && isset($comment->comment_ID)) {
$no = get_comment_meta($comment->comment_ID, 'post-icon',true);
if ($no) {
$img = wp_get_attachment_url(get_theme_mod("hvn_comment_img{$no}_setting"));
if ($img) {
$avatar = "<img src={$img} class=avatar>";
}
}
}
}

return $avatar;
}, 100001, 2);
52 changes: 52 additions & 0 deletions skins/skin-made-in-heaven/lib/panel-main.php
Expand Up @@ -528,5 +528,57 @@ function hvn_main($wp_customize) {
)
)
);


$wp_customize->add_setting('hvn_label7_main_section');
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'hvn_label7_main_section',
array(
'label' => '■ コメント',
'section' => 'hvn_main_section',
'settings' => 'hvn_label7_main_section',
'type' => 'hidden',
)
)
);


for ($i=1; $i<=3; $i++) {
$label = null;
if ($i == 1) {
$label = '画像';
}
$wp_customize->add_setting('hvn_comment_img' . $i . '_setting');
$wp_customize->add_control(
new WP_Customize_Media_Control(
$wp_customize,
'hvn_comment_img' . $i . '_setting',
array(
'label' => $label,
'description' => '画像[' . $i . ']',
'section' => 'hvn_main_section',
'settings' => 'hvn_comment_img'. $i . '_setting',
'mime_type' => 'image',
)
)
);
}


$wp_customize->add_setting('hvn_comment_setting', array('default' => false));
$wp_customize->add_control(
new WP_Customize_Control(
$wp_customize,
'hvn_comment_setting',
array(
'label' => 'コメントアイコン選択・表示',
'section' => 'hvn_main_section',
'settings' => 'hvn_comment_setting',
'type' => 'checkbox',
)
)
);
}
endif;
6 changes: 5 additions & 1 deletion skins/skin-made-in-heaven/style.css
Expand Up @@ -7,7 +7,7 @@
Author: chu-ya
Author URI: https://ss1.xrea.com/chuya.s239.xrea.com/temp/
Screenshot URI: https://im-cocoon.net/wp-content/uploads/skin-made-in-heaven.png
Version: 1.0.1
Version: 2.0.0
Priority: 6900001000
*/

Expand Down Expand Up @@ -72,6 +72,10 @@
** タブのCSS追加
** プルクオートのCSS追加
** 1.0.1 2023-04-19 バグ対策
** 2.0.0 2023-04-23 タイムラインのCSS追加
** カラーパレットを追加
** コメントアイコンを追加
** ブログカードのスタイル追加
**
*******************************************************************************/

Expand Down
33 changes: 33 additions & 0 deletions skins/skin-made-in-heaven/tmp/css-custom.php
Expand Up @@ -1057,6 +1057,39 @@
}


//******************************************************************************
// コメント
//******************************************************************************
if (get_theme_mod('hvn_comment_setting')) {
echo <<< EOF
.hvn-comment {
display: flex;
gap: 5px;
}
.hvn-comment-icon {
display: flex;
flex-direction: column;
gap: 5px;
}
.hvn-comment figure {
aspect-ratio: 1 / 1;
width: 50px;
}
.hvn-comment img {
object-fit: cover;
height: 100%;
}
EOF;

}


//******************************************************************************
//
// メインビジュアル
Expand Down

0 comments on commit fa645aa

Please sign in to comment.