I have looked into http://codex.wordpress.org/Custom_Fields. And know how to target custom posts and output them on a page.
Now i need to create custom fields in all posts inside category.php and inside single.php.
I will make fields to be two buttons and later that will link to other pages.
However i can't find answer how i am supposed to add custom fields to specific category posts. Ofcourse every post with buttons will have a unique link.
Could anyone point me in the right direction how i am supposed to create custom fields in all posts of a specific category?
Related
Please help me to add taxonomy terms from custom taxonomy into home page. I have no idea how to do this as I'm coming from WordPress. In WordPress it is easy as calling get_terms(). I have following file as my home page: mytheme/templates/page--front.html.twig
I have more than one taxonomy type and all of them are going to queried in the home page.
How to query the taxonomy terms?
UPDATE:
I have created a new region called home_content in my theme.info.yml and I have created a view(block) for getting the taxonomy terms, added it to region in back-end and display it as {{page.home_content}}. It works but I have few questions.
I have fields for logo and text in the taxonomy. I want to list them too.
I need to customize the html. How can I do that?
Thanks for the support.
You don't really need to code anything
Create view with taxonomy terms required. Structure > Views > Create New View and add block view for taxonomy terms. User filter section to select specific terms or dictionaries. Save the view.
Go to Structure > Block Layout and insert block with your view into desired region. In visibility section, pages tab: type <front> in pages and select Show for the listed pages in order to display it on home page only.
Above steps will display your required terms on home page.
To copy and modify template(s) in your theme, follow the instructions on drupal.org: https://www.drupal.org/node/2358785
I have created a custom post type named vehicles and there are different categories for that like trucks, cars, vans etc. I have created a taxonomy named vehicles-categories and now I want to show posts from taxonomy like cars on specific page which will show only posts from that certain category/taxonomy.
I have written WordPress custom loop but it does takes me to index.php page while I want different styles for that cars page.
Can anyone figure out what's am I doing wrong?
You have to create a custom template for your taxonomy to show posts from that specific taxonomy.
In your case if you want to show posts from term "car" then your template name will become taxonomy-vehicles-categories-car.php and WordPress will show posts on this page (you can style and get data according to your needs in this template).
Similarly, you can create taxonomy-vehicles-categories.php page to show posts from this taxonomy and can code this page to show posts as you want.
For further and in-depth understanding about how WordPress uses taxonomy template files visit the official codex page.
I have a problem with WordPress Custom Post Types that I can't seem to wrap my head around.
I would like to have a category or a custom taxonomy checkbox on my custom post type, and if this one is checked, then display the post in the WordPress main loop and in the WordPress feed.
Note: I don't want to display all posts from my custom post type in the main loop and feed, only the ones that are checked.
Is this even possible to achieve? I've tried to google for a solution, but with no luck so far.
Thanks!
// Jens.
I am really working hard to get a specific Post view in my Wordpress blog.
Example
Click http://theunlockr.com/roms/
Then Click http://theunlockr.com/roms/android-roms/
Then CLick http://theunlockr.com/roms/android-roms/asus-roms/
I figured that this is a nested view of categories and subcategories and finally the post in the respective category.
Need some input on how to do this on a basic wordpress blog.
I have already tried page builder and Grid views and alot of plugins, but cant really make this kind of view.
This is done via custom post types and custom taxonomies.
For example, you could create a custom post type rom, and assign the custom taxonomy roms with child categories Android ROMs -> Asus ROMs. This child category is assigned to the custom post type.
I want to create a dropdown list of all categories, but have it directed to a specific page (not the default category page) with the variable in the URL, i.e. "?page=50&cat=3".
So far, I've only found functions that have the link to "?cat=3" built in, so it defaults to the category page, rather than a specified page. What's the best way to do what I want?
Edit: Essentially, I need an array of category names and their respective IDs.
What you can do is create a separate template ( refer word press for creating a template file), assign that template to new page.
You can get the page id easily for the template and while showing drop down, you can link all the categories to that page, so when you click over the link, you would get the category using,
get_query_var or from $_GET
And then whatever you want to achieve, you can add your custom code in the template for that category.
You can fetch categories using http://codex.wordpress.org/Function_Reference/get_categories
get_categories();