Getting category URL with hyphens, not spaces
Try this <a href=”https://wordpress.stackexchange.com/category/<?php foreach((get_the_category()) as $category) { echo $category->slug .” ‘; } ?>”> Hope this helps.
Try this <a href=”https://wordpress.stackexchange.com/category/<?php foreach((get_the_category()) as $category) { echo $category->slug .” ‘; } ?>”> Hope this helps.
parse_query is where the majority of the work is done. Query vars and is_ conditionals are set, and template-loader.php just checks those is_ conditional tags to load the appropriate template.
From quick look through related functions I don’t think there is one that retrieves terms for the post and allows explicit exclusion. However there is a convenient filter the_category_list right inside the function you use, with array of category objects, before they are turned into HTML output. This should be a very fitting place to … Read more
On a category archive, get_queried_object_id() will give you the category’s ID, which you can pass to get_category_link(): echo get_category_link( get_queried_object_id() );
The steps WordPress takes to serve a front end request are roughly- The incoming URL is parsed and converted to query vars. These query vars form the Main Query, which is sent to the database. WordPress looks at the results and determines if the request was successful or not, which determines what status header to … Read more
If you have a feature request for WordPress, the best way to get it addressed is to add a ticket on Trac. Then developers can adopt the task, patch WordPress, and submit the improvements to the next version. If a Trac ticket has already been created for a particular feature, you can comment on it … Read more
Try the code that follows the screenshot: (source: mikeschinkel.com) <?php $categories = get_the_category(); foreach($categories as $key => $category) { $url = get_term_link((int)$category->term_id,’category’); $categories[$key] = “<dt><a href=\”{$url}\”>{$category->name}</a></dt>” . “<dd>{$category->category_description}</dd>”; } echo “<dl>\n” . implode(“\n”,$categories) . “\n</dl>”; ?> Also, <?php echo category_description(the_category_id()); ?> doesn’t do what you think it does. What follows will work on your category … Read more
there are some plugins that reveal the ID’s on the admin side like WP Show IDs and by code like this: //as dropdown $categories= get_categories(array(‘hide_empty’ => 0,’taxonomy’ => ‘category’)); echo ‘<select>’; foreach ($categories as $category) { $option = ‘<option value=”‘.$category->category_id.'”>’; $option .= $category->cat_name; $option .= ‘</option>’; echo $option; } echo ‘</select>’; //or just print the … Read more
I would surely use Pages instead of posts/categories in this case. Pages are meant to be “static” and posts are meant to be used for more dynamic content such as a blog. Pages also gives you an easier way to customize the look of individual pages if needed, with page templates. Have a look at … Read more
There is even an example in the WordPress codex here for this: http://codex.wordpress.org/Plugin_API/Action_Reference/pre_get_posts function exclude_category( $query ) { if ( $query->is_home() && $query->is_main_query() ) { $query->set( ‘cat’, ‘-3,-8’ ); } } add_action( ‘pre_get_posts’, ‘exclude_category’ ); Just modify the category IDs (replace -3,-8 by your category IDs preceded by the minus sign) and put it in … Read more