Skip to content

Instantly share code, notes, and snippets.

@rocket-martue
rocket-martue / snow-monkey-taxonomy-posts-fluid-shape-1.css
Created March 16, 2021 01:29
Snow Monkey 任意のタクソノミーの投稿の画像を「画像」ブロックで使用できる流体にする
.snow-monkey-taxonomy-posts .c-entry-summary__figure {
background-color:transparent;
}
.snow-monkey-taxonomy-posts .c-entries__item>a .c-entry-summary__figure>img {
-webkit-mask-repeat: no-repeat;
mask-repeat: no-repeat;
-webkit-mask-position: 50% 50%;
mask-position: 50% 50%;
-webkit-mask-size: contain;
add_action(
'after_setup_theme',
function() {
register_nav_menus(
[
'global-nav-2' => esc_html__( 'Global Navigation 2 (For PC)', 'snow-monkey' ),
'drawer-nav-2' => esc_html__( 'Drawer Navigation 2 (For Mobile)', 'snow-monkey' ),
'global-nav-3' => esc_html__( 'Global Navigation 3 (For PC)', 'snow-monkey' ),
'drawer-nav-3' => esc_html__( 'Drawer Navigation 3 (For Mobile)', 'snow-monkey' ),
]
add_action( 'admin_menu', function() {
add_menu_page( 'Reusable Blocks', '再利用ブロック', 'edit_posts', 'edit.php?post_type=wp_block', '', 'dashicons-block-default', 22 );
} );
@rocket-martue
rocket-martue / Snow Monkey で、フック (snow_monkey_append_main) を使ってページ下部に再利用ブロックを表示する
Last active March 12, 2021 13:50
Snow Monkey で、フック (snow_monkey_append_main) を使ってページ下部に再利用ブロックを表示する。
add_action(
'snow_monkey_append_main',
function() {
$reuse_block = get_post( $id ); // $id は、再利用ブロックのID
echo apply_filters( 'the_content', $reuse_block->post_content );
}
);
@rocket-martue
rocket-martue / [section slug=$slug ]
Last active December 26, 2020 08:38
テーマのsectionディレクトリのファイルを呼び出すショートコード
add_shortcode( 'section', function( $atts ) {
extract( shortcode_atts(
array(
'slug' => '',
), $atts ) );
ob_start();
get_template_part( 'section/'.$slug );
$html = ob_get_contents();
ob_end_clean();
return $html;
@rocket-martue
rocket-martue / [inc_file slug=$slug]
Last active December 26, 2020 08:32
テーマのincディレクトリにあるテンプレートを呼び出すショートコード
add_shortcode( 'inc_file', function ( $atts ) {
extract( shortcode_atts(
array(
'slug' => '',
), $atts ) );
ob_start();
get_template_part( 'inc/'.$slug );
$html = ob_get_contents();
ob_end_clean();
return $html;
h1.entry-title {
text-align: left;
font-size: 2.4rem;
}
@media (min-width: 700px) {
h1.entry-title {
font-size: 3.4rem;
}
}
@media (min-width: 1220px) {