Digital experiences for all disciplines
New Landing › How can we help? › Themeforest Theme Support › Flexform › Best method to create custom fields in Flexform Theme
New Landing › How can we help? › Themeforest Theme Support › Flexform › Best method to create custom fields in Flexform Theme
- This topic has 5 replies, 3 voices, and was last updated 8 years by David Martin – Support.
-
Posted in: Flexform
-
January 25, 2016 at 12:11 am #243154
Hi, I have a client who has an existing site using your Flexform theme.
I have a testing site at http://50.6.112.103/ where I’m running a copy of thier live site and I’m develeoping new features.
We are wanting to add the ability for my client’s customers to create a post that contains custom fields i.e Goals, Commitments, Strengths, etc. This post (and further posts) will show on their profile page and they will have the ability to edit these posts. (see a mockup @ http://50.6.112.103/properos-diversity-and-inclusion-embedding-tool-mockup-post/ )
I’m hoping to setup a front end ‘create a new post’ page using Gravity Forms and lock down the admin area for back end access to edit these posts.
I have used a plugin called wp-types to create a new post type and custom fields. https://wp-types.com/home/types-manage-post-types-taxonomy-and-custom-fields/
So far so good.
What I’m struggling with is how to, and where to add the code for the custom fields.
Should the code be written in the single.php page? If so, where should I put the code?
Or do I add a page called single-goal.php If so, where should I put the code?
Or do you have a better solution as to how I should achieve this?
January 25, 2016 at 7:46 am #243177Hi,
If you create custom field to custom post then put code at single-goal.php file otherwise put code at single.php.
Thanks
MohammadJanuary 25, 2016 at 10:51 am #243257Thanks for your reply Mohammad.
Can I trouble you for some more details in how to create and set up a single-goal.php file please?
To create a single-goal.php file… would I just duplicate the single.php file and rename it single-goal.php, edit it and put it in the Flexform theme folder?
To edit this new single-goal.php file and add my custom fields… would I use this code
<?php
echo types_render_usermeta_field( “goal”, array( “user_current” => true ) )
?>
And if so where do I put it (what line?) in the single-goal.php file?
Many thanks.
January 25, 2016 at 11:02 am #243262January 25, 2016 at 10:54 pm #243610Hi David,
cheers for the link. That helped with getting my head around PHP and I created a new single-goal.php file that is show all my custom fields… wahoo!
I have a new problem though in that I can’t seem to be able to ‘shortcode’ the new post type (goal). In the past I have used Swift Page Builder’s Blog Element to place the ‘posts on a page… but the Blog Element won’t pick up this new post type (presumably because the posts are goals and not posts).
Can you give me a heads up on how to resolve this please.
Note: as a work around I suppose I could make my goals a post and give it a category to separate it out
January 26, 2016 at 12:07 pm #243715Hi,
The file is
/wp-content/themes/flexform/includes/page-builder/composer/lib/shortcodes/blog.php
On line 118, you will see this
'post_type' => 'post',
You can edit that to add your new post type or pass a post type variable to it.
Thanks.
-
Posted in: Flexform
You must be logged in and have valid license to reply to this topic.