フォーラムへの返信
-
投稿者投稿
-
名前と得意分野で、それぞれコードを分けて以下のような感じでどうでしょうか?
/** * カスタム投稿タイプのアーカイブページにて、投稿一覧(リッチメディア型)のタイトルの前に、'名前:'を表示 * * @param string $html はコンテンツの中身. */ add_filter( 'snow_monkey_template_part_render_template-parts/loop/entry-summary/title/title', function ( $html ) { if ( 'banso-mate' !== get_post_type() ) { return $html; } $html = str_replace( '<h3>', '<h3>名前:', $html ); return $html; } ); /** * カスタム投稿タイプのアーカイブページにて、投稿一覧(リッチメディア型)に、タグ・ディスクリプションを表示 * * @param string $html はコンテンツの中身. */ add_filter( 'snow_monkey_template_part_render_template-parts/loop/entry-summary/content/content', function ( $html ) { if ( 'banso-mate' !== get_post_type() ) { return $html; } $postid = get_the_ID(); $taxonomy = 'banso_tags'; $post_terms = get_the_terms( $postid, $taxonomy ); if ( ! empty( $post_terms ) ) { $tags = '<div>'; $tags .= '<h3>得意分野:</h3>'; $tags .= '<div>'; $tags .= '<ul class="smb-taxonomy-terms__list">'; foreach ( $post_terms as $post_term ) { $term_name = $post_term->name; $tags .= '<li class="smb-taxonomy-terms__item">' . $term_name . '</li>'; } $tags .= '</div>'; $tags .= '</div>'; } $meta_description = get_post_meta( get_the_ID(), 'wp-seo-meta-description', true ); $html = $tags . '<div class="c-entry-summary__content">' .$meta_description. '</div>'; return $html; } );
WordPress のバージョンは、5.8でしょうか?
もし自動更新等で WordPress 本体のアップデートをされている場合、今使用されている Snow Monkey、Snow Monkey Blocks、Snow Monkey Editor は、WordPress5.8 に対応していないバージョンで不具合がでますので、以下のトピックを参考に本体をダウングレードしてください。プラグインを使用してダウングレードする場合、参考記事で紹介されているプラグインは一応動作しますが、メンテナンスが止まっているので、個人的には
Core Rollback (有効インストール数は少ないが、開発者はコアコントリビューター)
こちらのプラグインの使用をおすすめします。Snow Monkey のテーマやプラグインの β版は、本番サイトで使用するためのものではないので、正式版がリリースされてからアップデートされることをおすすめします。
とりあえず、現状のままで対応するなら.wpaw-pickup-slider.alignfull { margin-left: calc(50% - 50vw)!important; margin-right: calc(50% - 50vw)!important; width: 100vw!important; }
で、全幅にできます。
ただ、正式版がリリースされたら追加CSSは不要になると思います。WordPress 5.8 にアップデートしたからだと思います。 こちらで紹介されているプラグイン等で、ダウングレードしてください。
近日中に WordPress 5.8 対応の Snow Monkey がリリースされますので、それまで WordPress のアップデートは待ってください。
ありがとうございます。
get_post_type()
に変更で、うまくいきました。/** * 各投稿一覧で taxonomy のラベルをタイトルの上に表示 * * @param string $html はコンテンツの中身. */ add_filter( 'snow_monkey_template_part_render_template-parts/loop/entry-summary/title/title', function ( $html ) { $taxonomy = 'category'; $post_type = get_post_type(); switch ( $post_type ) { case 'post': $taxonomy = 'category'; break; case 'news': $taxonomy = 'news_category'; break; case 'shop-info': $taxonomy = 'shop_genre'; break; case 'interview': $taxonomy = ''; break; } $tags = ''; $postid = get_the_ID(); $post_terms = get_the_terms( $postid, $taxonomy ); if ( ! empty( $post_terms ) ) { $tags = '<ul class="' .$taxonomy. '-tags taxonomy-tags">'; foreach ( $post_terms as $post_term ) { $term_name = $post_term->name; $slug = $post_term->slug; $term_id = $post_term->term_id; $tags .= '<li class="' .$taxonomy. '-' .$term_id.' ' .$slug.'">' . $term_name . '</li>'; } $tags .= '</ul>'; } $html = str_replace( '<h3', $tags . '<h3', $html ); return $html; } );
なるほど!
無理に$name
を使わなくてもget_post_type()
で行けそうな気がします。
ちょっとコード書きなおしてみます。♥ 0いいねをした人: 居ませんこんにちは。
ロゴが大きくて画面の外にはみ出しているみたいです。
ロゴ画像の幅を狭くすれば表示されますね。
カスタマイザーでスマホのロゴのサイズを変更するか、以下のCSSを追加してみてください。.l-center-header .c-site-branding__title .custom-logo { max-width: 100%; }
♥ 0いいねをした人: 居ませんこんにちは
「続きをよむ」は、記事の詳細ページではなく一覧ページで全文表示している時に使う機能です。
使っているテーマによって、一覧ページでの表示は変わります。
詳細ページでは、設定で「コンテンツ全文ページで抜粋を非表示」をON
にしていると、「続きをよむ」より前の文章は表示されません。
私がやりたいことは、前の文章を少し表示、続きを読むボタンを押すとそのままページが変わらず続きが読めるようにしたいのです…
といった場合には、デフォルトの「続きを読む」ブロックではできません。
たぶんアコーディオンブロックの挙動が、やりたいことに近いと思います。
.smb-accordion__item__title
に頑張ってCSSをあてれば、見た目をボタン表示にできます。 -
投稿者投稿