Image on category page with Advanced Custom Fields - php

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.

Related

Limit custom taxonomy dropdown by custom post type

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

Wordpress ACF - Get taxonomy values

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/

How do I relate a taxonomy with a custom field type, on another custom field type?

I need to create a tiered relationship between posts in WordPress - I am using ACF (Advanced Custom Fields).
The end result is to create menus (food menus). There can be multiple menus (Breakfast, Lunch, Dinner), which will all have their own pages. On each menu will be a section ("Bread & Olives", "Starters, "Mains", "Burgers", etc.), and within that section will be the individual menu items (consisting of the name, description and price).
Currently, I have this set up as:
Menus - A custom post type, consisting of just a Title
Menu Items - A custom post type, consisting of a title, description, price
Menu Section - A taxonomy (category, not tag) of Menu Items
The problem is that a section needs to apply to only a single menu, not multiple. So, as the admin adding the menu items I need to be able to select the Menu it is linked to ("Evening"), which then populates a list of 'Sections' associated with that Menu.
Currently I can only list all Menus and all Menu Sections, so I need to some how create a relationship between those two when adding a Menu Item.
My question: How can I create this relationship, or am I approaching the problem incorrectly?
Thanks
If I understood your project right, the Menu should be another Taxonomy and not a custom post type. You can add more than one Taxonomy per post type.
This way you can create the Menu Item and associate it to one taxonomy (Menu Section, Starters, Burgers) and then add another box to associate the type (breakfast, lunch)
Here's an example of a Project I worked recently:
So, by parts:
The Custom Post Type Projects has associated two custom taxonomies - Categories and Portfolios. This item, in your case would be your Menu Items;
Portfolios would be your menus: Lunch, Breakfast, dinner, etc;
Categories Can be "bread and olives", "Starters", etc
This way you have all your associated data inside the same post and you can loop it easily with the get_terms() function.
About ACF, I've never worked with this one specifically, however I worked with others in the past that allowed to add a similar box to the post page.

Wordpress admin Posts lists filters

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?

Wordpress How to display all posts in category, with specific tag posts at top

I am trying to show the all Posts in the Category.
With the specific tag posts at the top.
For example:-
I want to show all the Posts in the Category 'CAR'
Now, I want that when i Click On 'CAR' Category the Posts With Tag 'BMW' Displays Firsts. And All Posts Left in Category 'CAR' Shown After the 'BMW' Tag Posts.
Please Help.
You need to create a custom page template (PHP) and associate your CAR category page to that custom page template.
Then, you need to customize your custom page template query, including all the post in the CAR category, ordering the posts by TAG.
Please find here the main rules for creating the correct custom template/page query: Official Wordpress Site.

Categories