Help with a get_categories () drop down menu – I want it to show in heirachial form

wp_dropdown_categories has a hierarchical and depth options available. $args = array( ‘show_option_all’ => ‘All Tshirt Categories’, ‘orderby’ => ‘ID’, ‘order’ => ‘ASC’, ‘hide_empty’ => 1, ‘child_of’ => 0, ‘hierarchical’ => 1, ‘depth’ => 1, ‘taxonomy’ => ‘tshirt_categories’, ‘hide_if_empty’ => false ); ?> <h2>By Category</h2> <form action=”<?php bloginfo(‘url’); ?>” method=”get”> <div> <?php wp_dropdown_categories($args); ?> <input type=”submit” … Read more

Compare current post Category in select menu

OMG – i falied to clean “$selected” value… hope this helps someone if you get confused for a moment like i did <?php $postId = $_POST[‘postid’]; // the value is recieved properly $currentCategory = get_the_category($postId); // the value is recieved properly $currentCategoryId = $currentCategory[0]->term_id; // the value is assigned properly $categories = get_categories(‘hide_empty=0’); // the … Read more

Theme Option select values

There’re several things to note: get_settings() is deprecated and get_option() should be used instead WordPress comes with a function named select() that takes three arguments: Saved value, looped value, echo You’re better off saving your key, than the HTML capable “title” element in your options. It’s much safer to save in the DB an easier … Read more

Select From wpdb – Author/User Directory page

You’re probably better off to use get_users which returns an array of <?php // get all users, regardless of roll. If you do need to restrict by // role you can use the `role` argument: get_users(array(‘role’ => ‘author’)); $uses = get_users(array(‘orderby’ => ‘nicename’)); foreach ($users as $user) { // do stuff with $user, will have … Read more

Add a select-option to the default widgets

The default widgets do not offer any hooks for that. You have to replace the default widget and add your field to the new class. The other option would be using JavaScript to insert the field, and a filter for ‘update_option_widget_’ . $widget->id_base to save the value. I think the separate class is the cleaner … Read more

Select post from dropdown and add query args not working

Rename your <select> to something other than page_id. The problem is that page_id is already taken (and handled) by WordPress (as query var). This should do, for example: <?php if (isset($_GET[‘editevent’]) && true == $_GET[‘editevent’]) echo ‘Post ID: ‘.$_GET[‘my_page_id’]; ?> <form method=”GET” action=”#”> <select name=”my_page_id” id=”my_page_id” onchange=”this.form.submit()”> <?php $args = array( ‘posts_per_page’ => -1, ‘post_type’ … Read more

Widget select option not saving

This line $type = isset( $instance[‘type’] ); will set $type to either true or false which never matches the string you check for later: foreach ($types as $option) { echo ‘<option value=”‘ . $option . ‘” id=”‘ . $option . ‘”‘, $type == $option ? ‘ selected=”selected”‘ : ”, ‘>’, $option, ‘</option>’; } You need … Read more

Help me SELECT thumbnail from SQL and use

You do not need to be messing with the database connection. WordPress provide a database object called $wpdb. It is not really clear what you are doing. Your title reads “help me select thumb”, but your code is actually pulling a lot of different post statuses, not thumbnails. In fact, your code does not have … Read more