Get Default Post Category From Settings

You can access to default category ID via default_category option: $default_category = get_option(‘default_category’); Now you can use selected() function to generate the selected attribute: <?php $args = array( ‘type’ => ‘post’, ‘hide_empty’ => 0 ); $categories = get_categories( $args ); $default_category = get_option(‘default_category’); ?> <select name=”category_name”> <?php foreach($categories as $category){ if ($category->name != ‘Uncategorized’) { … Read more

Does the ‘cat’ argument in query_posts fetch posts from subcategories as well as the given ID?

In short: Yes. Your question is about the query_posts WordPress PHP function. The link I’ve placed is the official wordpress codex documentation for that function. For your example it states: Display posts from only one category ID (and any children of that category): query_posts(‘cat=4’); I hope this information is helpful. You find more infos in … Read more

Dropdown with category selection

Here is a variation of the code that you use. I’m using get_categories() here to achieve the same goal. I had to adjust my code slightly to make it acceptable for your need. There are a however other modifications you have to make for this to work. When you select the All Categories option, you … Read more

Using categories & “stickyness” together

Just add ‘post__in’ => get_option(‘sticky_posts’) to your query, to confine your query to only sticky posts. So, $getHighlights = array( ‘numberposts’ => 7, ‘post_type’ => array(‘post’,’Event’), ‘post__in’ => get_option(‘sticky_posts’), ‘category_name’ => ‘Highlights’ ); should work for you. Edit: This is how you can merge two arrays to get the sticky posts at the top of … Read more

Hide Category from Blog?

You want the category 98 to be excluded only on the blog page, right? They should be accessible on the category page directly (your downloads page), correct? Can you try this? Let me know if its not what you want, we can modify it to suit your needs. Right not it only excludes the category … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)