Tagged: comment form, hook, metabox, Shortcode
- This topic has 3 replies, 2 voices, and was last updated 5 years, 7 months ago by
morganrt.
-
AuthorPosts
-
-
July 7, 2016 at 10:48 am #6912
-
July 8, 2016 at 10:12 am #6919
SteveKeymaster@morganrt– You don’t need to drop in a shortcode, you can just use a Piklist field. I’m not exactly sure which hook to use, but the function can look like this:
function extra_comment_fields() { piklist('field', array( 'type' => 'text' ,'field' => 'my_label' ,'scope' => 'comment_meta' ,'label' => 'My label' )); }This can go in your functions.php file.
Let us know if this works for you and which hook you ended up using.
-
July 8, 2016 at 10:35 am #6920
SteveKeymasterI just tried hooking to these functions, and the field renders but it doesn’t save.
Looks like a bug. I’ll put in a ticket for it but it may take a while.
-
July 8, 2016 at 6:47 pm #6925
morganrtMemberHello,
Thanks for the reply. I was using the shortcode because all the piklist fields are in a file in the metabox folder. I’ve been trying to keep things as close as possible to the documentation.Before I heard from you, I found that the shortcode with the comment_form action worked when placed in my plugin file.
function my_comment_form() { echo '<p class="comment-form-comment"> '. do_shortcode('[piklist_form form="comment_form-metabox" add_on="toggle360"]').' </p>'; } add_action( 'comment_form', 'my_comment_form' );This will save when I press the submit button. The shortcode added to the appropriate place in the theme displays but its submit button does not display.
Now I just need to figure out how to remove the default submit button!
Thanks,
Morgan
-
-
AuthorPosts
- You must be logged in to reply to this topic.