Forums

wp_get_archives & User Registration (3 posts)

  1. picard102
    Member
    Posted 6 years ago #

    Okay, so I have two questions here.

    1) In the sidebar the latest posts are displayed using wp_get_archive, is there any way too modify it so that it displays the latest posts from all categories except for category 2 (or whatever ID). If not, any suggestions on how to work that out another way?

    2) How would I make the "Last Name", or any other field, a required field.

    Working with the latest version of WP and a modified K2 theme.

  2. Kafkaesqui
    Moderator
    Posted 6 years ago #

    1. If wp_get_archives() is set with the type of 'postbypost' to display post title links, you could duplicate this by creating a new post query class and listing the query results in a mini-loop:

    <?php
    $archives = new WP_Query('cat=-2&showposts=10');
    while($archives->have_posts()) : $archives->the_post();
    ?>
    <li><a href="<?php the_permalink(); ?>" rel="bookmark"><?php the_title(); ?></a></li>
    <?php endwhile; ?>

    Setting the value of 'cat' to -2 negates that category from the listings. Set showposts the number of posts you want displayed in the list.

    2. I don't know of any plugin which provides this sort of restriction, nor can I think of what could be done to modify this in WordPress without modifications to the source. It may also be hard to work out since the default registration doesn't ask for this info; it's entered later at the user's discretion.

    EDIT: A little code fix. Note that WP_Query() accepts the same arguments as query_posts().

  3. picard102
    Member
    Posted 6 years ago #

    2. Any plug-ins that might work around that?

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags