Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 3796248
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 19, 20262026-05-19T13:12:26+00:00 2026-05-19T13:12:26+00:00

Having a bit of an issue with WordPress here. In all honesty I’ve always

  • 0

Having a bit of an issue with WordPress here. In all honesty I’ve always designed my sites from scratch and “coded” from the ground up. Lately I’ve been trying to work with WP as I’ve heard good things about it.

It would appear that WP gives you many things for free (e.g. dynamic “pages” based on CATEGORIES). However, I would like to know how to manipulate these freebies without reinventing the wheel. For example, I would like to have my SUB-MENU display a list of post categories. But I would like to sort those categories by a CUSTOM FIELD.

Now, I could reinvent the wheel and manually create (and link to) a new page for each sort, so on and so forth, (which I don’t fundamentally mind doing) however, I’m hoping there is a way around this via plugins or otherwise. I’ve seen several tutorials on custom queries, but they stop short of implementation — they simply give the query without telling exactly whether to create a new page or plug it into a function somewhere.

Any input would be most appreciated.

Best.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-19T13:12:27+00:00Added an answer on May 19, 2026 at 1:12 pm

    At the top of category.php template in your theme’s root directory, add the following to add your custom sort field to the query:

    <?php
    function is_valid_custom_sort_field($field)
    {
        // implementation left as an exercise for the questioner
        return true;
    }
    if ($_REQUEST['sort_custom_field'] && is_valid_custom_sort_field($_REQUEST['sort_custom_field'])) {
        query_posts($query_string . '&orderby='.$_REQUEST['sort_custom_field']);
    }
    

    See:
    http://codex.wordpress.org/Function_Reference/query_posts

    If your theme doesn’t have a category.php, here is a simple default template to base it on (copied from the included twentyten theme):

    <?php
    /**
     * The template for displaying Category Archive pages.
     */
    
    get_header(); ?>
    
            <div id="container">
                <div id="content" role="main">
    
                    <h1 class="page-title"><?php
                        printf( __( 'Category Archives: %s', 'twentyten' ), '<span>' . single_cat_title( '', false ) . '</span>' );
                    ?></h1>
                    <?php
                        $category_description = category_description();
                        if ( ! empty( $category_description ) )
                            echo '<div class="archive-meta">' . $category_description . '</div>';
    
                    /* Run the loop for the category page to output the posts.
                     * If you want to overload this in a child theme then include a file
                     * called loop-category.php and that will be used instead.
                     */
                    get_template_part( 'loop', 'category' );
                    ?>
    
                </div><!-- #content -->
            </div><!-- #container -->
    
    <?php get_sidebar(); ?>
    <?php get_footer(); ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

hello fellow java developers. I'm having a bit of an issue here. I have
Having a bit of an issue with wordpress URLs, it seems to automatically add
Coming from Win32, I am having bit of an issue or a problem trying
Having a bit of an issue here. I'm creating an application in Visual Studio
Im having a bit of an issue with decoding data coming from a database.
I'm having a bit of an issue with PHP emailing from a HTML form.
I am having a bit of an issue here... I have a Div and
I'm having a bit of an issue and, the other questions here didn't help
I'm having a bit of an issue here switching between my view controllers. I
I am having a bit of an issue getting the file path from the

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.