-
投稿者検索結果
-
2019年11月6日 1:30 PM #33986
返信が含まれるトピック: 投稿一覧から個別投稿ページへのリンクを無くしたい
了解です!
一応方法としては2つ考えられます。
–
template-parts/loop/entry-summary-news.php
をつくる
– フックでリンクを消す(デザイン > news アーカイブページ設定 > ビューテンプレートが「デフォルト」である必要あり)1つめの方法のほうが自由がききますが、2のほうが貼り付けるだけでさくっとやれるので、とりあえず2つめの方法を共有しますね。下記のコードを My Snow Monkey プラグイン、もしくは子テーマの
functions.php
に貼り付けてみてください。add_filter( 'snow_monkey_template_part_render', function( $html, $slug, $name ) { if ( 'template-parts/loop/entry-summary' === $slug && 'news' === $name ) { $html = preg_replace( '|<a [^>]+?>|ms', '', $html ); $html = str_replace( '|</a>', '', $html ); return $html; } return $html; }, 10, 3 );
♥ 0Who liked: No user*****[ プライベートトピックのため非表示 ]♥ 0Who liked: No user*****[ プライベートトピックのため非表示 ]♥ 0Who liked: No user2019年10月26日 8:57 AM #32051返信が含まれるトピック: 投稿のほうだけに「コンテンツの下」・「記事本文の下」ウィジットを表示させたい
コードを書かない方法としては、Widget Logic プラグインを使って、ウィジェット1つずつに表示条件を入れてく方法が考えられます。
コードを書いても良いのであれば、下記のコードを My Snow Monkey プラグイン、もしくは子テーマの
functions.php
に貼り付けてみてください。/** * 固定ページでは「コンテンツの下ウィジェットエリア」を消す */ add_filter( 'snow_monkey_template_part_render', function( $html, $slug ) { if ( 'template-parts/widget-area/contents-bottom' === $slug ) { if ( is_page() ) { return; } } return $html; }, 10, 2 ); /** * 固定ページでは「記事本文の下ウィジェットエリア」を消す */ add_filter( 'snow_monkey_template_part_render', function( $html, $slug ) { if ( 'template-parts/widget-area/article-bottom' === $slug ) { if ( is_page() ) { return; } } return $html; }, 10, 2 );
♥ 0Who liked: No user*****[ プライベートトピックのため非表示 ]♥ 0Who liked: No user*****[ プライベートトピックのため非表示 ]♥ 0Who liked: No user*****[ プライベートトピックのため非表示 ]♥ 0Who liked: No user2019年10月15日 4:14 PM #30674返信が含まれるトピック: スマホだけFooterCTAのラベルを変えたい
CSS ではなかなか無理くりになると思うので、PHP でモバイルかどうか判定して切り替えるのが良いと思います(なのでいわゆるレスポンシブではないです)
add_filter( 'snow_monkey_template_part_render', function( $html, $slug ) { if ( 'footer-cta/primary-btn' === $slug ) { $text = wp_is_mobile() ? 'モバイル用' : 'PC用'; return preg_replace( '|(<a[^>]*?>)([^<]+?)(</a>)|ms', '$1' . $text . '$3', $html ); } return $html; }, 11, 2 );
♥ 0Who liked: No user2019年10月9日 9:12 AM #30168返信が含まれるトピック: 特定のカテゴリーのアイキャッチ画像や関連記事を非表示にしたい
下記のコードを My Snow Monkey プラグイン、もしくは子テーマの
functions.php
に追加してみてください。add_filter( 'snow_monkey_template_part_render', function( $html, $slug ) { if ( 'template-parts/content/related-posts' === $slug ) { // カテゴリー a 以外のときは関連記事を非表示 if ( ! in_category( 'a' ) ) { return; } } return $html; }, 10, 2 );
♥ 0Who liked: No user2019年9月30日 4:35 AM #29206返信が含まれるトピック: カテゴリーページのh1を下書きの固定ページのタイトルに設定したい
あ、すみません、勘違いしていました。設定はないですね。下記のコードで実現できるかと思いますので試してみてください。
add_filter( 'snow_monkey_template_part_render', function( $html, $slug ) { if ( ! method_exists( '\Snow_Monkey\Plugin\ArchiveContent\App\Helper', 'get_term_meta_name' ) ) { return $html; } if ( 'template-parts/archive/entry/header/header' === $slug ) { $term = get_queried_object(); $term_meta_name = \Snow_Monkey\Plugin\ArchiveContent\App\Helper::get_term_meta_name( 'page-id', $term ); $page_id = get_theme_mod( $term_meta_name ); if ( $page_id ) { return preg_replace( '|(<h1 class="c-entry__title">).*?(</h1>)|ms', '$1' . get_the_title( $page_id ) . '$2', $html ); } } return $html; }, 10, 2 );
♥ 0Who liked: No user2019年9月28日 11:10 AM #29086返信が含まれるトピック: 「関連記事」の表記を変えたい
下記でどうでしょう?
add_filter( 'snow_monkey_template_part_render', function( $html, $slug ) { if ( 'template-parts/content/related-posts' === $slug ) { return preg_replace( '|<span>.*?関連記事|ms', '<span>あなたにオススメの記事', $html ); } return $html; }, 10, 2 );
♥ 1Who liked: No user2019年9月28日 11:01 AM #29083返信が含まれるトピック: カテゴリーページのアーカイブの記事タイトルタグをh2からh3に変更したい
下記でどうでしょうか。
add_filter( 'snow_monkey_template_part_render', function( $html, $slug ) { if ( 'template-parts/loop/entry-summary/title/title' === $slug ) { return preg_replace( '|<h2 class="c-entry-summary__title">(.*?)</h2>|ms', '<h3 class="c-entry-summary__title">$1</h3>', $html ); } return $html; }, 10, 2 );
♥ 0Who liked: No user2019年9月27日 2:44 PM #28988返信が含まれるトピック: 最近の投稿に最終更新日
情報ありがとうございます。こんな感じでしょうか? My Snow Monkey プラグインか子テーマの
functions.php
に下記をはりつけてみてください。add_filter( 'snow_monkey_template_part_render', function( $html, $slug ) { if ( 'template-parts/loop/entry-summary/meta/meta' === $slug ) { ob_start(); ?> <li class="c-meta__item c-meta__item--modified"> <?php the_modified_time( get_option( 'date_format' ) ); ?> </li> <?php $modifiled = ob_get_clean(); return preg_replace( '|(<li class="c-meta__item c-meta__item--published">.*?</li>)|ms', '$1' . $modifiled, $html ); } return $html; }, 10, 2 );
2019年9月20日 3:36 PM #28497返信が含まれるトピック: キャッチフレーズを、別けたい
ロゴの下のキャッチフレーズだけが変われば良いということですよね。こんな感じでどうでしょうか?
add_filter( 'snow_monkey_template_part_render', function( $html, $slug ) { if ( 'template-parts/header/site-branding' === $slug ) { return preg_replace( '|(<div class="c-site-branding__description">).+?(</div>)|s', '$1あいうえお$2', $html ); } return $html; }, 10, 2 );
♥ 0Who liked: No user2019年9月20日 9:22 AM #28438返信が含まれるトピック: 目次のデザイン(数字)を変更したい
以下、ご確認お願いします!
<?php /** * Plugin name: My Snow Monkey * Description: このプラグインに、あなたの Snow Monkey 用カスタマイズコードを書いてください。 * Version: 0.1.1 * * @package my-snow-monkey * @author inc2734 * @license GPL-2.0+ */ /** * Snow Monkey 以外のテーマを利用している場合は有効化してもカスタマイズが反映されないようにする */ $theme = wp_get_theme( get_template() ); if ( 'snow-monkey' !== $theme->template && 'snow-monkey/resources' !== $theme->template ) { return; } // サイドバーのウィジェットの見出しを h2 から h4 に変更する add_filter( 'dynamic_sidebar_params', function( $params ) { if ( preg_match( '|sidebar|', $params[0]['id'] ) ) { $params[0]['before_title'] = str_replace( '<h2 ', '<h4 ', $params[0]['before_title'] ); $params[0]['after_title'] = str_replace( '</h2> ', '</h4> ', $params[0]['after_title'] ); } return $params; } ); // コメントを非表示に add_action( 'snow_monkey_get_template_part_template-parts/discussion/comments', function() { } ); // トラックバックを非表示に add_action( 'snow_monkey_get_template_part_template-parts/discussion/pings', function() { } ); // 前後の投稿 add_filter( 'gettext', function( $translation, $text, $domain ) { if ( 'snow-monkey' === $domain && 'Old post' === $text ) { return '前の記事'; } elseif ( 'snow-monkey' === $domain && 'New post' === $text ) { return '次の記事'; } return $translation; }, 10, 3 ); // 記事一覧の日付の位置 add_filter( 'snow_monkey_template_part_render', function( $html, $slug, $name, $vars ) { if ( 'template-parts/loop/entry-summary' === $slug && 'post' === $name ) { if ( 'rich-media' === $vars['_entries_layout'] ) { $html = preg_replace( '|<div class="c-entry-summary__meta">.*?</div>|ms', '', $html ); ob_start(); \Framework\Helper::get_template_part( 'template-parts/loop/entry-summary/meta/meta' ); $meta = ob_get_clean(); $html = str_replace( '<h2 class="c-entry-summary__title">', $meta . '<h2 class="c-entry-summary__title">', $html ); } } return $html; }, 10, 4 ); // 投稿日でなく更新日 add_filter( 'snow_monkey_template_part_render', function( $html, $slug ) { if ( 'template-parts/loop/entry-summary/meta/meta' === $slug ) { return preg_replace( '|<li class="c-meta__item c-meta__item--published">.*?</li>|ms', '<li class="c-meta__item c-meta__item--modified">' . get_the_modified_time( get_option( 'date_format' ) ) . '</li>', $html ); } return $html; }, 10, 2 ); // add_filter( 'inc2734_wp_contents_outline_view_render', function( $html, $slug, $name, $vars ) { if ( 'wp-contents-outline' === $slug ) { return preg_replace( '|<h2 class="wpco__title">(.*?)</h2>|', '<div class="wpco__title">$1</div>"', $html ); } return $html; }, 10, 4 );
/*****目次*****/ .wpco{ position: relative; width: 100% !important; margin: 2.5em 0; background: #f9f9f9; box-shadow: 0 1.5px 2.4px rgba(0,0,0,.15); font-size: 15px; } .wpco .contents-outline a { flex-direction: row; padding: .23rem 0; } .wpco .contents-outline a:before { content: ''; width: 10px; height: 10px; border-radius: 100%; margin-top: 1em; font-size: 1px; overflow: hidden; padding: 0; background-color: #d5d5d5!important; } .wpco .contents-outline ol ol { font-size: 14px; }
♥ 0Who liked: No user -
投稿者検索結果