[resolved] Using 'Custom Field' or Meta as a linkable sortable item (4 posts)

  1. Ryan
    Posted 5 years ago #

    This may be a dumb question but.....

    I am playing around with creating a theme that is an internal ticket system. I have created a custom post type for the tickets themselves and have custom taxonomies for department and milestone. For these, I can use a taxonomy.php file for displaying them and create a link to them with get_term_link().

    I also have custom meta fields like 'Status' that can be set to open, closed, new, etc. My question is that if I want a user to be able to click on the meta tag and be taken to a page with all of the closed, open or new tickets how do I go about doing that? It doesn't seem to me that there is an equivalent get_term_link for meta data. And if there is such a function, what template file is the user redirected to?

    Hopefully, this makes some sense. It doesn't seem to me that the Status should be a taxonomy and it should be stored in the custom field but maybe I am mistaken.

    Many thanks for any replies.

  2. Devin Price
    Posted 5 years ago #

    I would make status another taxonomy. You can sort by meta fields, but you need to query them all (from what I know).

    You could also try finding a copy of Quality Control (http://wefunction.com/2010/08/quality-control-theme/) and see what he did.

  3. Ryan
    Posted 5 years ago #

    I believe you can query_posts by meta_key but that isn't the issue as much as if I wanted to do something like....

    $department_link = get_term_link($department, 'department');
    <a href='$department_link'>$department_name</a>

    [php opening and closing excluded for readability]

    While this is straightforward with a taxonomy I am not sure that it can be done or not with a meta key. I guess my question really comes down to if WordPress allows for a template based on meta keys like it does taxonomies.

    Thank you in advance.

  4. Ryan
    Posted 5 years ago #

    Gave up on this...I think I was wrong about the query posts by meta key and I ended up going with the taxonomy method. Thanks Devin. Case closed.

Topic Closed

This topic has been closed to new replies.

About this Topic