Tag Info

Hot answers tagged


Set has_archive to false. In order to keep the URL structure you want (/books/book-name), you'll need to add a rewrite rule: 'rewrite' => array('slug' => 'books'),


As far a I can understand you need to display the category name for the current page when viewing a category page. You can make use of the query variables to retrieve the category name, for example: $category = get_queried_object('cat');  echo $category->name; EDIT A global check to see what is returned by the main query for a specific page/template, ...


You must set your post counter outside your loop first before it will work. If you turn debugging on, you will get an undefined variable notice. You can do something like this just outside your loop before the loop starts $postvariable = 1; Alternatively you can make use of the build-in post counter, $wp_query->current_post. It starts counting at 0, so ...

Only top voted, non community-wiki answers of a minimum length are eligible