i need to know how to get posts from category by the name of it not the id???
-
lets say i have a category call ‘example’ if i want to use the query code to get the posts from this category all people use the query like that
<?php $showpost = new WP_query(); $showpost->query('showposts=3&orderby=date&cat=4'); ?>
(i get the right result that i need)
i use &cat=4 i get the posts from the category by the id of the category what if i want to get the posts by the name of the category like that<?php $showpost = new WP_query(); $showpost->query('showposts=3&orderby=date&cat=example'); ?>
(here i get all of the posts of the blog that mean that the code not working)what i have to do about it to work
please if there any idea to solve it i’ll really appreciate it
- The topic ‘i need to know how to get posts from category by the name of it not the id???’ is closed to new replies.