- Does Simple Fields use regular Custom Fields?
- Why does the “File” field type return an id, and not the name of the file?
- So how do I show an image based on a Simple Fields file field then?
- Can I sort posts based on a Simple Fields field?
- Why does dropdown return so wierd values?
Does Simple Fields use regular Custom Fields?
Yep. The selected values in a Simple Fields-box is stored as regular WordPress Custom Fields. That means you can use functions like get_post_meta and query_posts. To see the name of they custom field click the “show custom fields keys”-link that are available on the post edit screen.
Why does the “File” field type return an id, and not the name of the file?
When you get the saved value for a field of type “File” you only get the id of the attachment, and not for example the path to the file. That’s not a bug. It’s a feature.
Since I don’t know what the developer wants to do with a file (show it? print the filename? output the dimensions?) the plugin only returns the file ID, and then you can use WordPress own functions to fetch more info about the file.
Some useful functions to use in this case:
So how do I show an image based on a Simple Fields file field then?
One way to do it is like this:
<?php $image_id = get_post_meta(get_the_ID(), "_simple_fields_fieldGroupID_1_fieldID_1_numInSet_0", true); $img_src = wp_get_attachment_url($image_id, 'thumbnail'); ?> <img src=<?php echo $img_src ?> />
Can I sort posts based on a Simple Fields field?
Why does dropdown return so wierd values?
It may seem so, but it’s actually pretty smart. @todo: explain why the hell that is
Thanks for this great plugin.
The FAQ states:
“Can I sort posts based on a Simple Fields field?
But how can I actually inform my sortcode to use a field that exists as a Simple Fields field?
If I delete the plugin to get rid of the content on frontend, the content is still on the page, why that? how to delete it? it is not shown under the backend of the page but on the frontend. Please help me, I am stuck.
I tried to delete some fields. When I do “delete field” (Settings–>Simple Fields–> Manage), they did disappear from the field list, but later on, when I create a new post, the complete list of fields is there (including the deleted ones)
Is it possible to integrate this with woocommerce “add-ons” plugin?
Could anyone help me with making shortcodes work?
I’ve added an extra text field for a project, and it works as expected but doesn’t process shortcodes.
I read that it’s possible, is there a way to prompt WP to process these?
Is it possible to insert multiple images (i have a image custom field but clicking “Add” for each picture is quite time consuming). I’ve tried the plugin Faster Image Insert but to successfully insert the pictures i’d need to bind the pictures with custom fields for example or is there a good way to automate the Add link pressing ?
With best regards,
SHORT CODES FOR INSERTING SPECIFIC SIMPLE FIELDS INTO PAGES
Right now Simple Fields does not have its own shortcode scheme, so here is a workaround.
For my site, I need to be able to place any of the Simple Fields anywhere on a page using the page editor, not by editing the template. I succeeded in doing that by using another plugin, “Shortcode Exec PHP” . “internship” is one of my Simple Fields. In Shortcode Exec PHP I created a code block named [display_internship] and put the following code (from the Functions page of this site) into it:
$tempvariable = simple_fields_get_post_value(get_the_ID(), “internship”, true);
Now I can put [display_internship] into the text of the page. For this purpose, I have found that Shortcode Exec PHP works better than Hana Code Insert. For reasons I do not understand, Shortcode Exec PHP displays Simple Fields text using the page’s stylesheet, while Hana Code Insert does not.
For WordPress and PHP Newbies: The one thing you will need to change to use this workaround in the instance of “internship” in the code. Replace “internship” with the name of one of your Simple Fields. Keep the field name quoted.
Very Easy Display on Posts using shortcodes using a separate plugin:
Custom fields shortcode
Syntax in post editor:
Pär i don’t know weather this is a bug or not, but NONE of the files i upload throu a SimpleFields button gets attached to the current post. this is for file-field but also for the tinyMCE’s Media buttons.
Both bring up the WordPress (NextGenGal.) Upload Dialog and files get stored correctly to the Mediathek. I can even choose files from the Mediathek to insert in the post or field, but there is no ‘Gallery’-Tab. So i could not insert a gallery to the tinyMCE field?? …and i can’t use WP-functions for post-attachment to get e.g. the url of the thumbnail-size of an image?
Would be so great to have it. Is this intended to (not) work like this?
I’ll have a look at the plug-in’s code now maybe i can find something.
Thanks a lot!
Great post. It would be nice to have cretain checkboxes set as a group, like gym amenities: Circuit Training, Boxing etc, all under amenities.
Hi there, great plugin.
I have no php experience. Can you give me an example of how I can use the “File” field type to add a downloadable pdf attachment. What do I need to add to my template?