Situation: A page template contains pages with information about a topic and also runs a loop of posts about that topic - let's say: If is_page 'page1', show loop with tags about topic1 - If is_page 'page2', show loop with tags about topic2 ...
Wanted solution: I have +-25 pages about soccer teams that all need a loop with info about their specific team news(each team has a tag - not a category). But I only want to create 1 page template, because all the other information (the_content and some custom tags) is the similar for all pages.
Tried: I tried to fix this with get_template_part or get_query_var, but I cannot figure it out.
Any one can help me to get started?
You should probably use a custom field to associate your page with a team, then loop on it.
Check about Advanced Custom Field (ACF), it's a must have plugin.
Related
as you can see on my website www.bmhotellerie.it in the Take away category the products are displayed badly, I would like some advice on how to restore
I don't think it is category related. Here is the same issue on the same product, on the shop page :
https://www.bmhotellerie.it/shop/page/3/
It seems you have an unclosed tag somewhere on your product template.
As you can see, your .item-col element is inside another .item-col element.
Usually, it's the template templates/content-product.php that display products within loops :
https://github.com/woocommerce/woocommerce/blob/5.6.0/templates/content-product.php
My first guess will be to look at this template if your theme contains it. If not, maybe there is a hook or another template that create this issue...?
I am new with WooCommerce, and I don't know how to solve this issue. I have product with categories and tag.
In my home page I show two lists, product by tags and product by categories.
When I click in my first list I have to show something like this:
(return a list of this tag order by category)
Tag1
Category 1 (2) number of products
Category 2 (4)
Category 3 (1)
and when I click in Category 1, I show a product like product-tag.php file
For do this I override woocommerce plugin and add this in product-tag.php:
if (is_product_category()) :
include("product-category.php");
else:
if (is_product_tag()) :
include("listTag-product.php");
endif;
endif;
listTag-product.php is a new file that I created, but don't work, by default call to product-tag.php.
How to change this?
I want to use product_tag.php when I click in the list "Category 1 (2)" to show the product.
The problem is that a product tag can also be a product category or the opposite…
For that reason when using if (is_product_category()) the condition is always true and listTag-product.php will never be included…
Looking at WooCommerce templates, I don't see any:
product_tag.php template
product-category.php template…
The related existing WooCommerce templates are:
content-product_cat.php
taxonomy-product_cat
taxonomy-product_tag.php
After all why split this in 2 templates? You don't need that. You will better use the same template with fine tuned conditions inside it. But using conditionals as is_product_category() and is_product_tag() together is not the solution…
Depending on your thoughts, you could better use categories and subcategories instead of categories and tags.
If you want some real help, it will be better to reconsidering all, changing your approach and beginning to explore other ways. Here in Stackoverflow you will need to make a new question with more details and making available the code used in your templates or scripts, explaining with clarity, what is working and what not… For each problem one question at the time.
References:
Managing Product Categories, Tags and Attributes
Display WooCommerce Categories, Subcategories, and Products in Separate Lists
I'm working on a Wordpress 3.4 project. I have categories and then several tags, and also one custom taxonomy as types.
Wordpress is fantastic as far as it handles all the taxonomy page, but I'm unable to figure out how to have pages where I have categories listing page (with pagination) specifically filtered to a selected tag or custom taxonomy.
So basically I want Categories, but then again, I also need to have a categories page with all posts filtered to specific tag, and then with pagination.
I have tried to figure out how to do that, but unable to find the exact doc or help. The issue is also with the URL, as how it will be formed?
Any idea how to fix that one, or any plugin to get this things done?
I think these two codex pages will help you along your way.
http://codex.wordpress.org/Class_Reference/WP_Query
and
http://codex.wordpress.org/images/1/18/Template_Hierarchy.png
You can use WP_Query to query posts based on tags and categories/custom taxonomies and much more.
If you look at the template hierarchy you'll see you can use special template files for tags and taxonomies too. Just remember to flush your permalinks if you're not seeing these templates being used if you create one.
Is it possible to show posts by categories/tags on the index page instead of taking the user to the tag.php and category.php pages?
For example, when the user clicks the 'Uncategorized' category, I would like all the Uncategorized posts to replace the list of posts already there on the index page.
I've been trying to find out if anyone has done this but I've had no luck. I'd really appreciate it if someone could give me a link to somewhere that tells me how to go about doing this or lets me know how to change the code to get this to work.
This can be done. I can not recall a page that has done it but I do know it would require you creating your own custom page template.
http://codex.wordpress.org/Pages#Creating_Your_Own_Page_Templates is a good place to start learning how the page templates are created.
Some additional links
http://codex.wordpress.org/Displaying_Posts_Using_a_Custom_Select_Query
http://wordpress.org/support/topic/tag-archive-from-a-single-category-is-this-possible?replies=34
I have a little question. I am making a wordpress template that uses custom page templates. Now i ran into a problem. I want to create a page with a intro text and blog posts that come from a certain category. When a user creates a new page, I want them to be able to select the category from witch the posts are shown. Kinda like a drop down box with category's from where they can select the category they want. Does anyone maby knows a tutorial where I could learn how to do this ?
I mean something like this: http://imageshack.us/photo/my-images/10/naamloosea.jpg/
I already searched google but I could only find tutorials on how to make a template options page.
Thanks in advance,
Bob
You would want to create a Meta Box to save the category as a custom field entry within Pages. In here you could list the categories within a select box. You could then use this in the page template to pull in the posts from that category as you wish. I'll see if I can dig out a decent tutorial for this.
I did a quick search and found the following plugin for WordPress that may be of use... http://wordpress.org/extend/plugins/map-categories-to-pages/