Take the 2-minute tour ×
WordPress Development Stack Exchange is a question and answer site for WordPress developers and administrators. It's 100% free, no registration required.

What would I need to do so that every row has a unique input box, which the user inputs a numeric value, and then the category name is appended to it.

e.g

Category | Time
-----------------
Home     |   7

So that the 7 would be entered into the input box, but when the value is saved, it is appened with the category name. Bear in mind there would be multiple categories. This is what I have so far

$categories = get_categories($args);
          foreach($categories as $category) { 
            echo "<tr>";
            echo '<td><a href="' . get_category_link( $category->term_id ) . '" title="' . sprintf( __( "View all posts in %s" ), $category->name ) . '" ' . '>' . $category->name.'</a></td>';
            echo "<td><input/></td>";
            echo "</tr>";
            } 
share|improve this question

migrated from stackoverflow.com Jun 3 '12 at 19:35

This question came from our site for professional and enthusiast programmers.

    
Are you just trying to provide a form that users can use to filter the posts displayed to a specific category? I.E., "Enter the category name to view all posts in that category." –  Pippin Jun 4 '12 at 14:42

1 Answer 1

I'm not quite sure how you'll be using these but wouldn't it make sense to concatenate the category ID with the name to make it unique?

<input type="text" name="<?php echo $category->term_id."-".$category->name; ?>" />
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.