I add new custom field to load my Books genres (taxonomy) in to my "writer" page (category).
look at my settings:
http://awesomescreenshot.com/0df4qucud7
I need to show the checked genres on my writer page.
Of coure if theres no checked genres the code shows nothing (IF tag).
How can I get the values?
ACF Plugin: https://wordpress.org/plugins/advanced-custom-fields/
You are getting the term ID's of the selected genres.
With the ID you can get a field like so get_field('field_name', 'genre-cat');
In this situation the genre-cat can be replaced for the output of your field with the term IDs (you would have to do this for each term selected, so use the foreach statement).
See full documentation from ACF on how to get values from a taxonomy term: http://www.advancedcustomfields.com/resources/get-values-from-a-taxonomy-term/
Related
I'm wondering how can I put custom field in category page, is it possible?
I already used it to display on taxonomy term and its visible on list of all category but no in single category edit page.
ACF data is attached to term ID, so you cannot create it before the term (category) is created. You can only see ACF fields when term is created, so in edit page only. That's how it works.
I have 2 custom post types connected to the same custom taxonomy. On a particular page I needed to filter one particular post type using the filter that I created for my custom taxonomy. I was able to get a dropdown of my custom taxonomy using <?php wp_dropdown_categories( $args ); ?> but what I noticed was that it listed all the terms for which atleast one of the 2 custom post types had a post linked to it.
Here's an example of what I'm trying to do:
1. I have 2 custom post types: Cars and Bikes
2. I have a custom taxonomy (Location)
3. On a specific page, I need to filter the post type Cars using the dropdown that I created for my taxonomy
4. The problem that I'm facing is that the dropdown for my taxonomy Location, lists the locations that even posts from the Bikes post type are also connected to. So for example, if I have posts from the Cars post type connected to USA, UK, Australia and a post from the Bikes post type connected to Brazil, the dropdown for my custom taxonomy lists the 'Brazil' term too even though none of the Cars posts are linked to it.
Is it possible to restrict the dropdown for taxonomies to one custom post type?
I asked the same question on the Wordpress Stackexchange site and got the answer. Linking to it in case anyone else is interested in it:
https://wordpress.stackexchange.com/questions/207655/restrict-taxonomy-dropdown-to-post-type
I want to add a filters in my posts list because i add a checkbox Custom field in every post to set if the post is featured or not.
On the Posts list, i created a new colomn where i display YES if the post in featured and NO if the post is not.
But, how can i make a dropdown list filters with a checkbox ACF?
I think i need the metakey of the checkbox and the value, but i cant figure out... i have try with (true,false) as the values and featured as the metakey (featured is the field name of the checkbox ACF) but still not working... anybody have an idea?
In my admin for part i have additional fields (like price or brand - which is taxonomy). When i edit or create new part, i set up additional data.
and price saving is without any problem, but saving value from select list is something strange - it didn't save:
wp_set_object_terms($post_id, $_POST['part_brand'], 'brands', true);
according to wp doc: this function update value from taxonomy select. But for me it didn't work.
All code you could see here:
http://pastebin.com/N4gZL3uN
how to save value from select list (taxonomy) in wp?
i see that it didn't display selected value, why?
So, I have some subcategories, and in each category I insert some posts, when I show the posts for each subcategory I don't want to show the FIRST inserted post in that subcategory, only the posts that are not the FIRST ONE.How can I do this with query_posts..or how?
Best Regards
//SOLVED I will use a custom field
See offset parameter in function reference
query_posts('posts_per_page=5&offset=1');