Tagged: editor, metabox, pages, post_content
- This topic has 9 replies, 3 voices, and was last updated 7 years, 4 months ago by
Gary.
-
AuthorPosts
-
-
February 28, 2014 at 10:17 am #1474
JasonKeymasterI’m starting to mess around with metaboxes in pages, and I’m curious what all Piklist can do with pages.
As far as I can tell, Piklist cannot load a Workflow into a page. In addition, how would one add the meta to the page object (like post instead of post_meta)? Can the editor be replaced, or can metaboxes really only be added?
I don’t see any docs specific to pages, is why I ask.
Thanks!
-
February 28, 2014 at 10:49 am #1477
-
February 28, 2014 at 10:51 am #1478
JasonKeymasterThat is awesome. Thanks, Steve!
Seeing as the page isn’t “defined” like a post type, how would I remove the default editor in order to design a proper workflow?
-
February 28, 2014 at 4:42 pm #1483
SteveKeymaster -
May 1, 2014 at 9:56 am #1684
JasonKeymasterFor those interested, I had a case where I wanted to hide the editor from only specific pages using a specific template. Here’s what I did:
add_action('init', 'remove_unused_editors'); function remove_unused_editors() { $post_id = $_GET['post'] ? $_GET['post'] : $_POST['post_ID'] ; $template_file = get_post_meta($post_id,'_wp_page_template',TRUE); switch ($template_file) { case 'page-about.php': case 'page-home.php': remove_post_type_support('page', 'editor'); } } -
May 1, 2014 at 1:27 pm #1686
-
July 9, 2014 at 4:29 pm #1979
JasonKeymasterAmended the above code to avoid some php warnings:
add_action('init', 'remove_unused_editors'); function remove_unused_editors() { if ( !isset($_GET['post']) && !isset($_GET['post_ID']) ) return; $post_id = ( isset($_GET['post']) ) ? $_GET['post'] : $_POST['post_ID'] ; $template_file = get_post_meta($post_id,'_wp_page_template',TRUE); switch ($template_file) { case 'page-product-overview.php': remove_post_type_support('page', 'editor'); } } -
October 3, 2014 at 9:10 pm #2519
GaryMemberHi Steve!
Please help me.
I removed the default editor and created my metabox (The demo metabox, what you showed). Now I want to add the editor field, but I can’t find where to insert it. I apologise for my clumsy, but I really don’t see, where to put this into:
<?php piklist('field', array( 'type' => 'editor' ,'scope' => 'post' ,'field' => 'field_name' ,'label' => __('Example Field') ,'description' => __('This is a description of the field.') ,'value' => 'Lorem ipsum dolor sit amet, consectetur adipiscing elit.' ,'options' => array ( 'wpautop' => true ,'media_buttons' => true ,'tabindex' => '' ,'editor_css' => '' ,'editor_class' => '' ,'teeny' => false ,'dfw' => false ,'tinymce' => true ,'quicktags' => true ) ))?>Thank you for your help!
Best Regards,
Gary-
October 4, 2014 at 12:16 am #2520
SteveKeymaster@gary–
Just verifying… you’re using this tutorial, correct?
A few things:
1) This code goes in a file (any name you want), in the /meta-boxes/ folder. See this doc for the full path of this folder.
2) The file should also contain a comment block at the top. You can see how this looks here.
3) Replace,'field' => 'field_name'with,'field' => 'post_content'. Since you are replacing the default WordPress field, you need to use the WordPress field name which is post_content.Let me know if this works for you.
-
-
October 4, 2014 at 10:04 am #2524
GaryMemberThank you for your help.
I started re-editing the entrie tutorial and what you have written, managed to better understand the whole.
<?php echo get_post_meta($post->ID, 'demo_text', true); echo get_post_meta($post->ID, 'demo_select', true); echo get_post_meta($post->ID, 'demo_colorpicker', true); ?>I remembered that I put into this code, but it can not be accidentally. Now it’s work!
Thank you so much!!
-
-
AuthorPosts
- You must be logged in to reply to this topic.