フォーラムへの返信

4件の返信を表示中 - 1 - 4件目 (全4件中)
  • トピック投稿者 doggs

    (@doggs)

    ishitakaさん

    熟練の勘ということですね!
    本当にありがとうございます。

    トピック投稿者 doggs

    (@doggs)

    ishitakaさん

    上記にて改善いたしました。
    ありがとうございます。
    大変助かりました。

    wrapper – State that tells that the current format is a container format for block elements. For example a div wrapper or blockquote.

    ブロック要素のcontainerだったらtrue
    h2にはブロック要素がいれられないので、falseにする必要があったということでしょうか。

    トピック投稿者 doggs

    (@doggs)

    ishitakaさん、ご返信ありがとうございます。

    具体的なコードは下記となります。

    // Callback function to filter the MCE settings
    function my_mce_before_init_insert_formats( $init_array ) {  
    	// Define the style_formats array
    	$style_formats = array(  
    		// Each array child is a format with it's own settings
    		array(  
    			'title' => '.translation',  
    			'block' => 'h2',  
    			'classes' => 'translation',
    			'wrapper' => true,
    			
    		),  
    		array(  
    			'title' => '⇠.rtl',  
    			'block' => 'blockquote',  
    			'classes' => 'rtl',
    			'wrapper' => true,
    		),
    		array(  
    			'title' => '.ltr⇢',  
    			'block' => 'blockquote',  
    			'classes' => 'ltr',
    			'wrapper' => true,
    		),
    	);  
    	// Insert the array, JSON ENCODED, into 'style_formats'
    	$init_array['style_formats'] = json_encode( $style_formats );  
    	
    	return $init_array;  
      
    } 
    // Attach callback to 'tiny_mce_before_init' 
    add_filter( 'tiny_mce_before_init', 'my_mce_before_init_insert_formats' );  

    下記ページのコード最初のblockの部分をh2に変更いたしました。
    https://codex.wordpress.org/TinyMCE_Custom_Styles

    ドロップダウンメニューには表示されるのですが、
    h2の部分を選択をしても、文章に適用がされないような状況です。

    トピック投稿者 doggs

    (@doggs)

    CG (@du-bist-der-lenz)さん
    ご返信ありがとうございます。

    私もここまでは確認が出来ております。
    実際に適用をしようとすると、
    入力済みの文字にスタイルに変化が起きず。

    テキストエディタで確認をすると
    やはりh2などが適用されておりません。

4件の返信を表示中 - 1 - 4件目 (全4件中)