WordPress.org

Ready to get started?Download WordPress

Ideas

Increase support for post-formats in all functions that take category arguments

  1. adelval
    Member

    12345

    I think post-formats can take much of the more straightforward functionality that one would traditionally obtain with either post categories or custom post types, with much less hassle. Normal editors may well forget to select the right category everytime, when that's important for functionality and not just categorization; and custom post types may for many tasks be a bit overblown and more work for the developer.

    In a recent site I decided to use asides as just that, asides, to appear only in a widget in the sidebar. But then I had to exclude them from all queries except for its taxonomy and the widget query (through pre_get_posts), from next and previous links in single posts, and from link rel=next and link=prev links in the head. For the latter two tasks, I need all asides to belong to a given category to be able to use the exclude_categories arguments, and I don't trust my users to always remember to assign it.

    My suggestion is twofold:
    - replace category arguments in most or all functions by tax_query (at most letting legacy category arguments as shorthands and for backward compatibility)
    - provide much more support (including visual support) in the core for editing various post-formats, along the lines of the CF Post Format plugin.

    As I see it, post-formats are useful to separate various functionalities, not just for having different presentation styles. They are like predefined custom post types.

    Posted: 1 year ago #
  2. DavidWordP
    Member

    It is already there. Advanced Taxonomy queries use a new parameter to the query functions called “tax_query”. The tax_query is an array of arrays, with each array describing what you want it to match on.

    $myquery['tax_query'] = array(
    array(
    'taxonomy' => 'category',
    'terms' => array('foo'),
    'field' => 'slug',
    ),
    array(
    'taxonomy' => 'post_tag',
    'terms' => array('bar'),
    'field' => 'slug',
    ),
    );
    query_posts($myquery);

    Posted: 1 year ago #
  3. JeffKantona
    Member

    I had copied and tried this code on my local Apache server.

    It has some mistakes:
    Please replace the order of parameters, and you dont need to make the second array. Put it simple' here is the revised code:

    $myquery['tax_query'] = array(
    array(
    'taxonomy' => 'category',
    'field' => 'slug',
    'terms' => array('foo')
    )

    It was quite challenging playing with this...

    Posted: 11 months ago #
  4. randyahaloms
    Member

    try this (added a few lines, corrected other)

    $myquery['tax_query'] = array(
    array(
    'category' => 'domain',
    'terms' => array('foo'),
    'field' => 'slug',
    ),
    array(
    'taxonomy' => 'post_tag',
    'terms' => array('bar'),
    'field' => 'slug',
    ),
    );
    query_posts($myquery);

    array(
    'catehory' => 'post_tag',
    'terms' => array('find'),
    'field' => 'slug',
    ),
    );
    query_posts($myquery);

    Let me know if it worked.

    Posted: 7 months ago #

RSS feed for this topic

Reply

You must log in to post.

  • Rating

    12345
    3 Votes
  • Status

    This idea is under consideration