WordPress.org

Ready to get started?Download WordPress

Forums

Adding categories to the Prologue theme; success (16 posts)

  1. timotheus
    Member
    Posted 5 years ago #

    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.

  2. houseofstrauss
    Member
    Posted 5 years ago #

    Great post timotheus, and an excellent improvement to the theme. It all went smoothly in my hacks. Only thing is, categories do NOT show in the post metadata area. Looks like they should do, so I added after tags on line 75 index.php

    Posted in <?php the_category(', ') ?>

    This prints the category after the tags.

    Thanks for your inspiration.

  3. dwharrington
    Member
    Posted 5 years ago #

    Would you or anyone know how to do this in P2, the latest Prologue update? Above works awesome in Prologue. Thanks in advance. If you don't have P2 yet: http://svn.automattic.com/wpcom-themes/p2/

  4. houseofstrauss
    Member
    Posted 5 years ago #

    Try it on a test site :)

  5. jicola.com
    Member
    Posted 5 years ago #

    How do you allow guests to post on Prologue theme?

    Can someone tell me how?
    Thanks

  6. houseofstrauss
    Member
    Posted 5 years ago #

    As the theme stands you can't. It requirs that posters are 'authors' not subscribers. I don't know if you can hack this, because it uses the core permissions to allow posting.

    If you want anonymous posting, try TDO forms plugin In fact you could build a theme just like prologue using tdo forms and have much tighter control over who posts, moderation and customisation.

    I've given this some thought ... what's the difference between the prologue theme and an ordinary wp page with 'Hello , 'whatcha doing' in the content and then allowing comments? With a bit of styling you can make it look just the same, put the comment form above the content and the comments output below, etc...

  7. timotheus
    Member
    Posted 5 years ago #

    @houseofstrauss Good idea, I didn't think to show the category in the post area as well.

    I'm glad people found this useful!

  8. jicola.com
    Member
    Posted 5 years ago #

    Is it then possible to change wordpress by default to allow guests to be authors?

    For my current site, I was using the posthaste plugin which is basically the does the same thing as this topic says, but I just wanted to show the form and allow anonymous posts.

    Is it possible to put like an if statement somewhere that "if not logged in, show form and give username anonymous" or something like that?

    What I also want is to allow the category name to be at the start of every new post, I tried doing this, but failed. All i got was the word Array in front of it.

  9. houseofstrauss
    Member
    Posted 5 years ago #

    Is it then possible to change wordpress by default to allow guests to be authors?

    Not that I know of. Guest have no rights except to post comments if you approve this in the admin options. Again, TDO-forms is the way to go if you want anonymous posting/ flood control and full moderation/ spam control etc. TDO-Forms is very well setup for this kind of application.

    What you can do is allow new blog registrations to become any role you like, ie author, rather than subscriber. This is an option in the admin settings of wordpress. BTW, This is way you have to run the prologue theme.

    I havn't used postehast, yet, so I can't say how versatile it is with permissions etc.

  10. khongcoai
    Member
    Posted 4 years ago #

    @ Timotheus

    Thanks, FYI I just tried to do it on P2, and I found the lines of codes in the functions.php (line 700) nevertheless when posting the message, the loop does not take in account the selected category :(

  11. timotheus
    Member
    Posted 4 years ago #

    @ khongcoai

    I am pretty sure P2 will need some additional adjustments in order to make it work.

    I am actually in the process of making plugins for Prologue and P2 that will add this functionality. It will also allow the user to select between a dropdown of categories, and a group of checkboxes for the categories, allowing a post to be in more than one category.

  12. biznis86
    Member
    Posted 4 years ago #

    Check out this theme: Rask -> it's P2 on steroids :) ... and uses post categoires as well as post titles on front page.

  13. kpmcm1
    Member
    Posted 4 years ago #

    I've set up my P2 theme to accept anonymous comments. However, the comment box still asks for the user to enter their email address. Is there a way correct this? I'd like to remove the text that says entering a email address is required. To elaborate a bit further, users are actually able to enter anonymous comments by just leaving the email box blank. So, the anonymous comments feature does work - now I'd like to remove the text that says the email address is required.

  14. peleus
    Member
    Posted 4 years ago #

    @ timotheus

    Is there a chance to show categories in alphabetical order and hierarchically?

  15. Tanmoy
    Member
    Posted 4 years ago #

    can i allow subscriber to use posthaste rather than author?

  16. Andre_ger
    Member
    Posted 4 years ago #

    @ Timotheus

    You wrote that you are in the process of making plugins for P2 that will add the category functionality. Do you have some new informations about that? I'm creating a wordpress Site at the moment, that would work perfectly with the P2 theme. But I definiteley need to have the possibility to choose the category when writing a new post.

    It would be great If you had some good news for me. :-)

    (Sorry, my english isn't the best)

    Best Wishes,
    Andre

Topic Closed

This topic has been closed to new replies.

About this Topic