Creating a new theme, and come across an issue which should be simple to fix but can’t work it out.
Basically I need to stack the statements, not join them up e.g.
statement 1 Statement 2 Statement 3 Statement 4
Each statement would be different, generating the contents differently hence why they need to be stacked.
The first statement works fine, but the following 3 statements aren’t working, my code currently looks like:
if(has_tags('hot')) {
}
if(has_tags('cold')) {
}
if(has_tags('medium')) {
}
if(has_tags('freezing')) {
}
I know it’s going to be something simple but I can’t find the answer
Any help appreciated
- Author had a File in an Envato Bundle
- Author was Featured
- Bought between 1 and 9 items
- Europe
- Exclusive Author
- Has been a member for 2-3 years
- Item was Featured
- Referred between 100 and 199 users
elseif ?
elseif doesn’t work because it will only display the first statement, I need to display all the statements at once, as they are basically grabbing 4 articles which are tagged in each category.
- Author had a File in an Envato Bundle
- Author was Featured
- Bought between 1 and 9 items
- Europe
- Exclusive Author
- Has been a member for 2-3 years
- Item was Featured
- Referred between 100 and 199 users
using query_posts?
yea looks like I will be going down that route, thanks
- Author had a File in an Envato Bundle
- Author was Featured
- Bought between 1 and 9 items
- Europe
- Exclusive Author
- Has been a member for 2-3 years
- Item was Featured
- Referred between 100 and 199 users
that was the main idea. do not use query_posts, it may result in strange results. use wp_query class ( it does not change global variables as query_posts does) . glad i could give you an idea.
Not sure how has_tags() works for you, since the function is called has_tag().
Also, not sure I understood what you’re trying to achieve, but has_tag() must be in the loop, as it needs the returned post’s ID to work.
So, something like this can’t work:
if (has_tag('tagname')) {
// loop here
}
- Sold between 250 000 and 1 000 000 dollars
- Item was Featured
- Author was Featured
- Bought between 100 and 499 items
- Has been a member for 2-3 years
- Exclusive Author
if ( has_tag('one') || has_tag('two') || has_tag('three') ) Thanks for the replies but solved it with query_posts for now
@ DI – Basically I need to list 4 separate posts, each category will have 4 posts which will be tagged with a different tag, basically showing the best deals from that category
You can view what I mean here
@ Minky – As above, that method won’t work as I need them in separate boxes, each different (see my link to see what I mean).
I have fixed it now with query posts but if there is a better method, I would implement it.
