List all categories in options

To get a list of selectable categories use wp_dropdown_categories(). Example: wp_dropdown_categories( array ( ‘orderby’ => ‘name’, // ID of the already selected category: ‘selected’ => 4, // If no category is selected: ‘show_option_none’ => ‘Choose one’ ) ); HTML output: <select name=”cat” id=’cat’ class=”postform” > <option value=”-1″>Choose one</option> <option class=”level-0″ value=”4″ selected=”selected”>Animals</option> <option class=”level-0″ value=”6″>Hyperbolica</option> … Read more

wp alchemy multiple image uploader output images to template

Do you have any output code we can reference? Put this in your Theme file: <img src=”https://wordpress.stackexchange.com/questions/45576/<?php get_the_value(“imgurl’); ?>” style=”width:100px;height:100px” /> if you have multiple you’ll have to go through a foreach loop: <?php foreach ($meta[‘imgurl’] as $img ) { echo ‘<a href=”#” /><img src=”‘. $img .'” /></a>’; } ?> Hope this helps, I don’t … Read more

Generate Catalog Of Posts Based On Template

To get all posts ordered by their template you need two functions: one for the query, and one to add a custom order. Get the posts function get_posts_by_template() { add_filter( ‘posts_orderby’, ‘orderby_template’ ); $query = new WP_Query( array( //’meta_key’ => ‘_wp_page_template’, ‘post_type’ => ‘any’, ‘orderby’ => ‘title’, ‘order’ => ‘ASC’, ‘posts_per_page’ => -1, // dangerous … Read more

WordPress’ visual editor messing up my (nested) lists (and other things as well)

Instead of using the “type” attribute, try adding a CSS class and styling that. <ol> <li>Number one</li> <li>Number two <ol class=”lower-alpha”> <li>Lowercase a</li> <li>Lowercase b <ul> <li>Paragraph 1</li> <li>Paragraph 2</li> </ul> </li> </ol> </li> </ol> Then in your CSS – depending on your site setup, you may want to add Custom CSS through the Customizer, … Read more

Get all sub-categories of a parent category

In reply to your updated code, you should know that the $post_terms = wp_get_object_terms() would only return categories that directly attached to the post, so I’d just use wp_list_categories() to get and display the child categories for the given (or a known) parent category. And here’s the code that works well for me which displays … Read more

wp_dropdown_categories and custom taxonomy + custom post type

You can get your code to work the expected way by adding the following three arguments to your $args array which you pass to wp_dropdown_categories(): name — the select name as in <select name=”<here>”>, and you should set it to theme which is your custom taxonomy slug. value_field — the value of the <option>‘s in … Read more

wordpress wp_list_categories

Hi @matt ryan: Simplest way to do what you want is to use PHP output buffering. I haven’t tested it yet but this should work: ob_start(); wp_list_categories( $args ); $html = ob_get_clean(); echo str_replace(get_bloginfo(‘wpurl’),”,$html); UPDATE You could also using the ‘wp_list_categories’ hook like this: add_action(‘wp_list_categories’,’mysite_wp_list_categories’); function mysite_wp_list_categories( $output ) { return str_replace( get_bloginfo(‘wpurl’),”, $output ); … Read more

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