Home › Forums › Calendar Products › Community Events › Display Additional Field outside of "other" grouping
- This topic has 12 replies, 2 voices, and was last updated 10 years, 1 month ago by
George.
-
AuthorPosts
-
February 21, 2016 at 9:28 pm #1079561
Mad Dog
ParticipantI’ve added an Additional Field but would like to display it at the top of the Add/Modify Event pages rather than in the “Additional Fields” grouping. Aside from something weird like grabbing that nth child, making it absolute and specifically placing it elsewhere on the page, is there another way to call that one additional field and put it somewhere else on the page?
I am using
add_action('tribe_events_community_form_before_template', 'my_custom_text');and could put some code in with that if there’s a way to call that specific Additional Field.THANKS!
Mad Dog-
This topic was modified 10 years, 2 months ago by
Mad Dog.
February 22, 2016 at 1:48 pm #1080181George
ParticipantHey Mad Dog,
Additional Fields are fundamentally just “post meta” fields in WordPress, so you SHOULD be able to access specific fields there.
I would recommend tinkering around with this, for starters:
$meta = get_post_meta( get_the_ID() );
Then do a var_dump() on that $meta variable (do a quick Google search for “var_dump()” if you’re not familiar with it!):
$meta = get_post_meta( get_the_ID() );var_dump( $meta );
You should be able to see all of the event meta here, and should see the array structures in place to access a specific “Additional Field” field.
I hope this helps and wish you luck with your tinkering!
β George
February 22, 2016 at 2:17 pm #1080198Mad Dog
ParticipantThanks but I’m not sure that will help. I don’t want to display the field (it’s actually for admin’s information), I want to move its location on the Add/Edit Event page.
By default, all the entry inputs for Custom Fields group together under “Additional Fields” for Community User entry and editing. I want one of those field inputs to be elsewhere on the Add/Edit Event page.
How can I do that?
(I hope this is clearer.)
Thanks,
Mad DogFebruary 23, 2016 at 8:38 am #1080808George
ParticipantSorry about my misreading of your question, Mad Dog. This was what I was responding to:
I am using add_action(‘tribe_events_community_form_before_template’, ‘my_custom_text’); and could put some code in with that if thereβs a way to call that specific Additional Field
Your second question here, though, seems to imply that the action tribe_events_community_form_before_template is not working, though? Is this right?
Because that is the action I would recommend using! It should do the job here well, in terms of letting you place content before the section you are referring to.
Thank you for your patience here, and again, apologies for the misunderstanding on my end! π
β George
February 23, 2016 at 8:54 am #1080813Mad Dog
ParticipantThanks for getting back to me but apparently I’m still not being clear about my question. Sorry about that.
– I’ve added an Additional Field (custom field if you will) through PRO. We’ll label it “New Course.”
– When a Community User adds or edits an event, it is grouped with the other Additional Fields under the heading “OTHER.”
– I want this one field input to be at the TOP of the page, NOT grouped with “OTHER.”
That’s it.
The only reason I mentioned tribe_events_community_form_before_template is because I am using it at the top of the page and it works fine, so if there’s a way I can include a call to include the field input for “New Course” along with my code there it will do exactly what I need.
I hope this makes more sense. It seems like it should be pretty simple….
Thanks,
Mad DogFebruary 23, 2016 at 9:03 am #1080829George
ParticipantHey Mad Dog,
Thanks for the further elaboration here. My first response to you does seem to address this, then π
1. Putting Info at the Top of the Page
You will want to use tribe_events_community_form_before_template to generate information at the top of the page.
2. Making That Info be the Value of One Custom Field
To get just one field and pull it out of the “OTHER” section and move it into the section from tribe_events_community_form_before_template, you will need to use the get_post_meta() function I described initially.
This function returns the post meta, and so you can then pull just one item from this post meta because it is an array of values. If you do the var_dump() method I recommended, you’ll see what array key this field is, then just echo this array key.
I hope this helps!
β George
February 24, 2016 at 8:31 am #1081462Mad Dog
ParticipantThat’s simple for displaying the post meta, but I’m not clear how to move the INPUT FIELD on the Add/Modify Event page.
I know the meta is _ecp_custom_12. Below is the actual source code for the input on the page but I don’t think I want to add that to the top using tribe_events_community_form_before_template. In Edit it won’t pick up the existing content of the field. It seems there should be a tag or something I should use, doesn’t it? Not to mention if I put that up top the input field will appear on the page twice since it’s still in “Other” (which I can hide using CSS but it’s still on the page).
<tr> <td> <label for="_ecp_custom_12" class="">New Course: </label> </td> <td> <select name="_ecp_custom_12"> <option value="No" >No </option> <option value="Yes" >Yes</option> </select> </td> </tr>Thanks,
MDFebruary 24, 2016 at 8:57 am #1081525Mad Dog
ParticipantBTW….I see someone else is asking a very similar question about moving a Custom Field to another part of the page:
Additional field added (photo credits) should show under image upload
It’s not just me!
February 25, 2016 at 8:13 am #1081970George
ParticipantHey @Mad Dog,
Thank you for elaborating on your question even further; and for your patience!
To move the “Additional Fields” module, you’ll want to move this line of code around inside the edit-event.php:
tribe_get_template_part( 'community/modules/custom' );That’s where the additional fields inputs are generated, so moving it up or around the src/views/edit-event.php file in Community Events should do the job here.
Consult our themer’s guide for more information if you haven’t done so already β https://theeventscalendar.com/knowledgebase/themers-guide/
Thank you,
GeorgeFebruary 25, 2016 at 8:32 am #1081990Mad Dog
ParticipantI’m kind of at a loss as to why I’m having so much trouble being clear about the problem. I did what you just suggested 6 months ago to move the entire section to another part of the page. That’s not the issue at all.
I’m trying to move ONE FIELD out of that section to a different place on the page.
Not the whole section.
I don’t know any way to be clearer about this and it’s been a week of back and forth.
Thanks,
MDFebruary 25, 2016 at 3:43 pm #1082240George
ParticipantI am sorry about the confusion here. I honestly am. Please understand that it was a simple misunderstanding on my part; I’m genuinely interested in helping here, I just misread and misunderstood your questions and am sorry about that!
I’m also sorry that, at this time, there is no solution to achieve what you are trying to do other than what you described in your original post on this thread:
Aside from something weird like grabbing that nth child, making it absolute and specifically placing it elsewhere on the page, is there another way to call that one additional field and put it somewhere else on the page?
Sincerely,
GeorgeFebruary 25, 2016 at 4:00 pm #1082242Mad Dog
ParticipantThanks….it took a while and unfortunately the answer is what I was afraid it was going to be, but at least we got it!
Thanks for sticking with me on this. I’ve seen other support requests about this so hopefully one day they’ll change the routine so this is possible.
Thanks again!
MD
February 25, 2016 at 4:09 pm #1082252George
ParticipantThank you for sticking with this, Mad Dog. I’m really sorry for the confusion and back-and-forth.
Improving these features would indeed be a helpful thing; stay tuned to plugin updates in case some tweaks and fixes ever arrive related to the additional fields. To be frank, I do not know of any plans for that at this time, but this is the sort of improvement I would be happy to bring up with developers and see how feasible the changes are to implement.
I will close up this thread for now, but please open a new thread any time if there’s anything else we can try to help with.
Thank you,
George -
This topic was modified 10 years, 2 months ago by
-
AuthorPosts
- The topic ‘Display Additional Field outside of "other" grouping’ is closed to new replies.
