0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

WordPress iPad/iPhone/Androidでの改行問題

Last updated at Posted at 2020-07-29

iPad/iPhoneで改行ができない!

知人に提供しているWordPressのページに、iPadで改行ができないから何とかしてほしいとの依頼が入りました。iPad/iPhoneでは、Shift+Enterができないことが原因です。Androidも同様の問題があるようです。

典型的な対策

「がんばれ」で済ませたかったのですが、どうも本当に困っているようなので調べてみました。
調べてみると、苦労されている方が多いようですが、iPadにキーボードをつけるという解決策がほとんど。キーボードをつけてはどうかと提案しましたが、移動中にWordPressを更新したいので、キーボードは無理!ということになりました。

WordPressのfunctions.phpで対応

仕方がないのでさらに調べてみると、WordPressのfunctions.phpで、改行を変更できることを見つけました。

[WordPress]スマホアプリで改行と段落をどうするのかを色々と模索

/*
 * Enter for iPad
 * src https://blog.g-fellows.com/web/wordpress/9328/                                            
 */
function TinyMceInitOptions4BrOnly( $initArray )
{
    $initArray = array_merge( $initArray,  array('force_br_newlines' =>  true) );
    $initArray = array_merge( $initArray,  array('forced_root_block' => '') );
    $initArray = array_merge( $initArray,  array('force_p_newlines' => false) );
    return $initArray;
}
add_filter('teeny_mce_before_init', 'TinyMceInitOptions4BrOnly');
add_filter('tiny_mce_before_init', 'TinyMceInitOptions4BrOnly');

むすび

修正を加えた結果、思ったように編集ができるようになったようです。
内容がわかって対応できたわけではない点が残念ですが、結果よしということになりました。

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?