Adding categories to the Prologue theme; success
-
First, I want to say I really like the Prologue theme. I have used it for several projects, and it is perfect, except for one thing. I really needed to be able to allow users to choose a category to assign to their post.
I spent some time today and successfully have it working. It is very easy to do, all you need to edit are three files of the theme: index.php, post_form.php and the style.css.
First, you add these two lines in post_form.php, where you want the category dropdown to be:
<label for="cat">Categories</label> <?php wp_dropdown_categories('hide_empty=0&name=post_category[]'); ?>
This makes a dropdown of your categories for your new post.
Then you need to alter the themes index.php. First, go to line 15:
$tags = $_POST['tags'];
hit enter to create a new line, then add:
$category = $_POST['post_category'];
On line 26:
'post_content' => $post_content,
hit enter to create a new line, then add:
'post_category' => $category,
And, technically you are done! However, with no CSS associated with a select box, it can look unsightly. Let’s add something to the CSS file that will properly design this to fir with the theme.
I went to line 118, which is the ending brace of the styling info for:
#postbox input#tags
You know the drill, hit enter for a new line and then put:
#postbox select { font-size: 1.2em; padding: 2px; border: 1px solid #c6d9e9; margin-left: 70px; }
And you should be all set!
I hope this saves people some time.
- The topic ‘Adding categories to the Prologue theme; success’ is closed to new replies.