Display Custom Fields ABOVE Post Body

This topic contains 8 reply and 4 voices, and was last updated by Tom 9 years, 2 months ago
Viewing 8 Posts - 1 through 8 (of 8 total)
Author Posts
November 27, 2014 at 4:02 am 31268
Tom Hello I have built a form that includes custom fields such as "Textarea" "Dropdown" and "Image Upload". My problem is that when a user submits a post using this form, the custom field metadata is displayed BELOW the post body at the bottom of the page. This does not suit my needs. See example: http://artscouncil.mb.ca/?p=25224 I would like to display custom field data above the post body and after the title. I have looked through the php, but I cannot seem to make sense of where the meta data is being laid into the post. I have figured out how to get text based meta data (textarea and dropdowns, etc.) to display where I want it in the content.php file, but not images, nor can I remove the wpuf data from under the post. Can you please help?
November 27, 2014 at 11:20 am 31280
towhid towhid

Hello Matthew,

I have assigned this issue to our developer team. Hope I will be back to you with a right solution.

Thank You 🙂

November 28, 2014 at 11:15 am 31322
towhid towhid

Hello Matthew,

No need to edit the content.php file. You will see ‘CSS Class Name filed’. This filed is for write your own css and you can manage whatever you want.

Thank You.

🙂

December 1, 2014 at 11:09 pm 31520
Matthew Carreau Matthew Carreau

You cannot use CSS alone to change where custom fields are displayed in a post.

I had to assigne each custom field a META KEY, then go into the content.php and input custom code to get that field to display where I want it in the post.

For example, I have a custom field that asks the user for a phone number. I assiged that field a meta-key of “phone_number” and then inserted this PHP code into content.php above the code that generates the post-body but below the code that generates the post-title:

if (get_post_meta( $post>
ID, 'phone_number' )) {
echo '<li> <span class="metaTitle"> Phone Number: </span>';
echo get_post_meta( $post>
ID, 'phone_number', true );
echo '</li>';
}

This displays the phone number below the title, but the custom field is still visbible in its original position below the post-body. To remove it, I have to use custom CSS to the custom-field.

This is a really REALLY complicated work around.

Why are custom fields displayed at the bottom of the post? Why are they not displayed in the order that they appear in the form? Can you recommend a better way for me to do this?

Thank you.

December 12, 2014 at 11:57 am 32189
Hassane Hassane

I’m very interested in a solution to this problem. I want to do exactly the same thing.
Any hints?

I actually would want to put them in a table with the meta label and the meta value in 2 columns to format it to match my theme.

Thanks
Hassane

December 13, 2014 at 1:13 pm 32239
towhid towhid

Hello Hassane,

I have forward this issue to our developer team. They are trying to figure out a way. Hope I will back to you a right solutions.

Thank You 🙂

December 14, 2014 at 3:57 pm 32293
towhid towhid

Hello Hassane,

Please open wp-content/plugins/wedevs-wp-user-frontend/wpuf-functions.php and find wpuf_show_custom_fields functions. In this file has a filter for to modify the content. This filter appends the plugin’s form into content files. Then you can understand how the form displays in the content.

Hope you understand.

Thank You 🙂

December 15, 2014 at 5:32 am 32309
Hassane Hassane

I was able to get it done.
I commented 2 lines in function wpuf_show_custom_fields( $content )

//$image_html = '<li><label>' . $attr['label'] . ':</label> ';
//$image_html .= sprintf( '<a href="%s">%s</a> ', $full_size, $thumb );

Thanks,
Hassane

January 18, 2015 at 5:14 pm 34447
Tom Tom

Hi,

Hassane’s workaround doesn’t work for my form, it just ends up hiding images uploaded via the form. I’ve taken a look at wpuf_show_custom_fields but must admit the code is beyond my limited coding abilities! Is there no simple way to display a form in the order in which you create it in the edit stage?

Thanks,

Tom.

Viewing 8 Posts - 1 through 8 (of 8 total)