admin管理员组文章数量:1026989
I have an editor on the front end of a website using wp_editor. It mostly works as expected; very similar to the admin side editor. However, when I enter an audio or video link, the players are not rendered as they are on the admin side. For example, inputting:-
.mp3
...on the admin side will immediately render to the audio player. On my public side wp_editor, it remains as a URL string.
There are obviously some filters/scripts on the admin side that render these URLs that are not available as standard from the public facing side. Is it possible to get a public side wp_editor to behave exactly like the admin side editor? Its kind of pointless having front end editing if I lose a chunk of functionality from the admin side editor.
Im using my own custom plugin to launch the editor. Im using the following:-
function create_tinymce() {
$settings = array(
'media_buttons' => true,
'drag_drop_upload' => false,
'wpautop' => true,
);
wp_editor("", "my-editor", $settings);
}
Im then hooking the above function using:-
add_action( 'wp_head', 'create_tinymce', 0 );
I have an editor on the front end of a website using wp_editor. It mostly works as expected; very similar to the admin side editor. However, when I enter an audio or video link, the players are not rendered as they are on the admin side. For example, inputting:-
http://chromafunk/bucket/ring.mp3
...on the admin side will immediately render to the audio player. On my public side wp_editor, it remains as a URL string.
There are obviously some filters/scripts on the admin side that render these URLs that are not available as standard from the public facing side. Is it possible to get a public side wp_editor to behave exactly like the admin side editor? Its kind of pointless having front end editing if I lose a chunk of functionality from the admin side editor.
Im using my own custom plugin to launch the editor. Im using the following:-
function create_tinymce() {
$settings = array(
'media_buttons' => true,
'drag_drop_upload' => false,
'wpautop' => true,
);
wp_editor("", "my-editor", $settings);
}
Im then hooking the above function using:-
add_action( 'wp_head', 'create_tinymce', 0 );
Share
Improve this question
edited Jul 27, 2016 at 14:27
Michae Pavlos Michael
asked Jul 27, 2016 at 12:27
Michae Pavlos MichaelMichae Pavlos Michael
691 silver badge12 bronze badges
3
- How are you adding it to the frontend? Are you using a plugin? If not can you show us some of your code? – Fencer04 Commented Jul 27, 2016 at 13:23
- Thanks Fencer. Ive appended my OP with some code examples. – Michae Pavlos Michael Commented Jul 27, 2016 at 14:27
- There are 2 trac tickets regarding the oEmbed functionality outside of post/page edit screens here and here. It looks like it is on the radar but won't appear until an unspecified future release. – brianjohnhanna Commented Aug 3, 2016 at 15:58
1 Answer
Reset to default 2I've been fighting this for a while on a series of themes I make that provide a front end content creation interface not requiring a WP account. For the last two years I have said "trust me, URLs will embed".
Those old tickets are dormant, but I just have found a solution here https://wordpress.stackexchange/a/287623
For the template that renders the page you are using for your form, you need to add an enqueue statement.
This is some partial code on a site where auto embeds are not working on an editor added via wp_editor()
add_action('wp_enqueue_scripts', 'add_truwriter_scripts');
function add_truwriter_scripts() {
// set up main styles
$parent_style = 'radcliffe_style';
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style ),
wp_get_theme()->get('Version')
);
if ( is_page('write') ) { // use on just our form page
// Get Embed functionality in rich text editor
// h/t https://wordpress.stackexchange/a/287623
wp_enqueue_script( 'mce-view' );
:
:
// unrelated code follows
I have an editor on the front end of a website using wp_editor. It mostly works as expected; very similar to the admin side editor. However, when I enter an audio or video link, the players are not rendered as they are on the admin side. For example, inputting:-
.mp3
...on the admin side will immediately render to the audio player. On my public side wp_editor, it remains as a URL string.
There are obviously some filters/scripts on the admin side that render these URLs that are not available as standard from the public facing side. Is it possible to get a public side wp_editor to behave exactly like the admin side editor? Its kind of pointless having front end editing if I lose a chunk of functionality from the admin side editor.
Im using my own custom plugin to launch the editor. Im using the following:-
function create_tinymce() {
$settings = array(
'media_buttons' => true,
'drag_drop_upload' => false,
'wpautop' => true,
);
wp_editor("", "my-editor", $settings);
}
Im then hooking the above function using:-
add_action( 'wp_head', 'create_tinymce', 0 );
I have an editor on the front end of a website using wp_editor. It mostly works as expected; very similar to the admin side editor. However, when I enter an audio or video link, the players are not rendered as they are on the admin side. For example, inputting:-
http://chromafunk/bucket/ring.mp3
...on the admin side will immediately render to the audio player. On my public side wp_editor, it remains as a URL string.
There are obviously some filters/scripts on the admin side that render these URLs that are not available as standard from the public facing side. Is it possible to get a public side wp_editor to behave exactly like the admin side editor? Its kind of pointless having front end editing if I lose a chunk of functionality from the admin side editor.
Im using my own custom plugin to launch the editor. Im using the following:-
function create_tinymce() {
$settings = array(
'media_buttons' => true,
'drag_drop_upload' => false,
'wpautop' => true,
);
wp_editor("", "my-editor", $settings);
}
Im then hooking the above function using:-
add_action( 'wp_head', 'create_tinymce', 0 );
Share
Improve this question
edited Jul 27, 2016 at 14:27
Michae Pavlos Michael
asked Jul 27, 2016 at 12:27
Michae Pavlos MichaelMichae Pavlos Michael
691 silver badge12 bronze badges
3
- How are you adding it to the frontend? Are you using a plugin? If not can you show us some of your code? – Fencer04 Commented Jul 27, 2016 at 13:23
- Thanks Fencer. Ive appended my OP with some code examples. – Michae Pavlos Michael Commented Jul 27, 2016 at 14:27
- There are 2 trac tickets regarding the oEmbed functionality outside of post/page edit screens here and here. It looks like it is on the radar but won't appear until an unspecified future release. – brianjohnhanna Commented Aug 3, 2016 at 15:58
1 Answer
Reset to default 2I've been fighting this for a while on a series of themes I make that provide a front end content creation interface not requiring a WP account. For the last two years I have said "trust me, URLs will embed".
Those old tickets are dormant, but I just have found a solution here https://wordpress.stackexchange/a/287623
For the template that renders the page you are using for your form, you need to add an enqueue statement.
This is some partial code on a site where auto embeds are not working on an editor added via wp_editor()
add_action('wp_enqueue_scripts', 'add_truwriter_scripts');
function add_truwriter_scripts() {
// set up main styles
$parent_style = 'radcliffe_style';
wp_enqueue_style( $parent_style, get_template_directory_uri() . '/style.css' );
wp_enqueue_style( 'child-style',
get_stylesheet_directory_uri() . '/style.css',
array( $parent_style ),
wp_get_theme()->get('Version')
);
if ( is_page('write') ) { // use on just our form page
// Get Embed functionality in rich text editor
// h/t https://wordpress.stackexchange/a/287623
wp_enqueue_script( 'mce-view' );
:
:
// unrelated code follows
本文标签: mediaFront end wpeditor not rendering audiovideo links
版权声明:本文标题:media - Front end wp_editor not rendering audiovideo links 内容由热心网友自发贡献,该文观点仅代表作者本人, 转载请联系作者并注明出处:http://it.en369.cn/questions/1745667268a2162249.html, 本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌抄袭侵权/违法违规的内容,一经查实,本站将立刻删除。
发表评论