Home Forums Plugin Support WP User Frontend Pro Display Custom Fields ABOVE Post Body

This topic is: resolved

This topic contains 8 replies, has 4 voices, and was last updated by  Tom 4 years, 6 months ago.

Viewing 9 posts - 1 through 9 (of 9 total)
  • Author
    Posts
  • #31268

    Matthew Carreau
    Member
    Post count: 7

    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?

    #31280

    towhid
    Participant
    Post count: 4505

    Hello Matthew,

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

    Thank You ๐Ÿ™‚

    #31322

    towhid
    Participant
    Post count: 4505

    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.

    ๐Ÿ™‚

    #31520

    Matthew Carreau
    Member
    Post count: 7

    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.

    #32189

    Hassane
    Member
    Post count: 8

    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

    #32239

    towhid
    Participant
    Post count: 4505

    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 ๐Ÿ™‚

    #32293

    towhid
    Participant
    Post count: 4505

    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 ๐Ÿ™‚

    #32309

    Hassane
    Member
    Post count: 8

    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

    #34447

    Tom
    Member
    Post count: 6

    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 9 posts - 1 through 9 (of 9 total)

The topic ‘Display Custom Fields ABOVE Post Body’ is closed to new replies.