how to use custom field default value on wordpress - wordpress

i have a custom field in wordpress named cuisine
its a dropdown with the values of:
-asian
-african
-mexican
-american
-etc etc
whenever i add a post i can choose what type of cuisine it is.
now i have a custom page where all cuisine type should be there.
i want it dynamic which means it get its value from the custom field values
therefore i should be having this
-asian
-african
-mexican
-american
-etc etc
as my page contents.
problem:
how can i get this advance custom fields field? i mean the select field itself named cuisine
tried googling but always got different answer
*note: i am using 'Advanced Custom Fields 4.1.5.1' and 'WordPress v3.5.2'

thanks anyway.. solved it already
get_field_object($field_key);
is the answer.
hope it helps someone who will encounter this kind of question in the near future

Related

Page still showing advance custom fields value even if I changed the template in wordpress?

Hey everyone I came across this strange behavior. Actually I assigned Advance Custom Field to default template and that template was used in particular page so I entered the values in advance custom fields and displayed them in appropriate places in page.php.
But I now created a new template inner-template.php and assigned it to that page so now no ACF is showing in that page in edit mode but it is still displaying the ACF values when I call ACFs in inner-template.php.
Why this is occurring?
It's known behaviour of ACF. It occurs, because ACF doesn't delete field's values, when you change some conditions (for example, change the template for the page). You should do it manually before changing template or you can clear this fields directly from wp_postmeta table.

Wordpress: get previous_post_link() based on custom field value

I have a custom post type. Pages of this custom post type are displayed via a special template. in this template i use previous_post_link() and next_post_link() to create links to previous/next posts of this custom post type.
Since I currently only want to show a few of these custom-post-type pages to my users, I created a custom field called release with a boolean true/false value to indicate if these posts should be shown.
Obviously, the previous/next_post_link() functions should also be aware of that. However, they are not currently. That means they also link to pages where the custom field released is set to false. How can I tell these functions to only use pages where a custom field (released) has a specific value (true).
Update: I know that the solution is to apply some filters to the default functions and to somehow adapt the SQL query which is used to retrieve previous/next posts. However I do not know how to put together the puzzle pieces (where/how to apply the filters and how to adapt the SQL)
This may be related to this question, however I dont really know what to do: https://wordpress.stackexchange.com/questions/8823/how-to-order-adjacent-posts-prev-next-by-custom-field-value
This seems also to be related: https://wordpress.stackexchange.com/questions/96670/custom-post-type-navigation-on-custom-field
couldn't get it to work even though I know how it SHOULD work: addFilter() for get_{$adjacent}_post_join and get_{$adjacent}_post_where with custom SQL query code..
However, this plugin did the trick for me: http://www.ambrosite.com/plugins/next-previous-post-link-plus-for-wordpress
I used the in_same_meta key.

Drupal 7 - Term reference field: how to add new term?

I have some texonomies in my Drupal website. Some of them have additional fields. I have some fields of type Term reference in my content-types.
When I am creating a new node of a content-type, I would like to have the ability to add a new term to the taxonomy while I'm filling the form of the Content-Type (with an "add item" link/popup...).
I can do that if I use Entity Reference fields, but I cannot using Term reference field. Could you help me, please?
Thanks
UPDATE: I installed "Taxonomy access fix" module (https://www.drupal.org/project/taxonomy_access_fix) and it allows me to set capabilities per each taxonomy based on user role. Now I only need to add a new term to a Taxonomy on a form level using Term reference field (I canno use autocomplete because I need the user to see all possible values like with a dropdown).
Any help?
If you change your widget to the autocomplete widget, it will let you add new values.
I agree with #Dark FlameS, in fact we are using the autocomplete widget for some of our students to add types of trees in the biology lab and they tag each with the scientific name.
And since we dont know these scientific terms, we let them add taxonomy terms to the list.
Slight difference however, we use the module Autocomplete Deluxe. Works like magic for us.
You are able to see what taxonomy terms are already available by clicking into the text area.
And as you type a taxonomy term, you will see what other terms are similar. If a tag is new, it will be added. one thing, dont allow them to delete your tags. We learned this the hard way.
See the image below on what it looks like as you add a tag.
Above is what you will see when you are adding the taxonomy field in your content type, this is after you install the Autocomplete Deluxe module
Above is What the user sees when they add or select a taxonomy tag.

How to create a field consisting of a list of all nodes

Good day.
There is a problem: display news block on specific pages of any type of material.
I see the solution as follows: Create a field in the type of material "News" which will be displayed all the nodes (Title) with the possibility of using the mark checkboxes.
Who could help with advice: is it the right direction, and if yes - how to realize this field?
Thanks in advance for any help.
Download and enable Entity API and Entity reference modules.
Then go to your content type "Manage fields" page (admin/structure/types/manage/[CONTENT_TYPE]/fields) and add a new field of type Node reference. The rest of the configuration is left for your liking.

How can I add different types of posts in WordPress?

It's a vague question and I've searched throughout the Google and come up short. I want to create a type of content called an Employee. He should have 2 pictures attached, some text, a Facebook profile (optional), etc. Can I create a content type to handle this? I've tried the Custom Post Type UI Plugin, but that still gives me a standard type of Post, just with a new category, essentially. That's not what I want. I want the Add / Edit post screen to have these options laid out. I can handle the static content just fine with Custom Fields. The hard part is the image uploads.
Any thoughts?
Wow, very easy to do with a plugin called Advanced Custom Fields

Resources