PROBLEM-
I was planning to list a particular category on the home page. and I tried to use this code.
<?php query_posts($query_string . ‘&cat=1’); ?>
However later I realised that
mysite.com/?cat=n was also showing the same category as on home page.
LEARNING
don’t modify existing loop.php file in word press for category.
SOLUTION
I copied the loop.php as lopp-index.php and removed above code from loop.php
wish you good luck….
Category is one of the pre-defined taxonomies in WordPress. It is used to sort and group content into different sections. A website publishing content on a variety of topics can divide their website into sections using categories.
taxonomy is the one of the beautiful feature of wordpress. where one can create an hiarchical data structure. and create a parent child relationship. that will ultimately help you in addressing various needs of the protal you develop. each taxonomy object has associated ID, One can create a new taxonomy Object or even a new taxonomy itself. For example you can create school standard as one taxonomy, and student location as another taxonomy. then India, is one taxonomy object for location taxonomy. whereas class 9 is one taxonomy object for school standard taxonomy.
A category is an example of hierarchical taxonomy while tag is a member of non-hierarchical. For example you can create a category ‘Food’ & sub categories ‘Continental’ & ‘Oriental’ under it. Then you may go on adding more food items under both these sub categories. Similarly custom taxonomies can be both hierarchical & non-hierarchical. there are other advance taxonomy too.
Let’s lead by example. We want to get everything in the category of “foo” AND a tag of “bar”. Here’s our query:Here we’ve specified two arrays, each of which describes the taxonomy and terms we want to match it against. It’ll match against both of them, and only return the results where both are true. wordpress has so many functions related to taxonomy.
Most WordPress users are aware of certain terminologies like categories & tags. They are examples of taxonomy. Taxonomy is a content type used to manage contents of some other content type. Category & tag are most well known types of taxonomy.
Most WordPress users are aware of certain terminologies like categories & tags. They are examples of taxonomy. Taxonomy is a content type used to manage contents of some other content type. Category & tag are most well known types of taxonomy.
Even tags are one type of taxonomy, but tags are not hiarchical.
advanced taxonomy queries are cool, but be aware that complex queries are going to be slower. Not much slower, since the code does attempt to do things smartly, but each taxonomy you add is the equivalent of adding a JOIN. While the relevant tables are indexed, joins are still slower than non-joins. So it won’t always be a good idea to build out highly complex queries.
Still, it’s better than rolling your own complicated code to get a lot of things you don’t need and then parsing them out yourself. A whole lot easier too.