Wordpress wp_query and custom fields

112 Views Asked by At

I have a category, where posts are listed by this wp_query:

<?php $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
$args = array(
    'post_type' => 'post',
    'stage' => 'process',
    'paged' => $paged,
);
$query = new WP_Query( $args );

Using plugin m_snap (alphabetical order of posts) there is a problem. It provides custom field for any post with a letter. So, the URL becomes something like this:

[...]/category/product/letter/A/ but has no difference with [...]/category/product/

How can I correct wp_query to get proper list of posts using m_snap?

UPD. Found that it's something wrong with rewriting urls. This is code from plugin:

    function m_snap_generate_rewrite_rules($wp_rewrite) {
        $IIIIIIIII1ll = array (
            'letter/(.+)' => 'index.php?letter=' . $wp_rewrite->preg_index(1),
            'tag/(.+?)/letter/(.+)' => 'index.php?tag='.$wp_rewrite->preg_index(1).'&letter='.$wp_rewrite->preg_index(2),
            'category/(.+?)/letter/(.+)' => 'index.php?category_name='.$wp_rewrite->preg_index(1).'&letter='.$wp_rewrite->preg_index(2)
        );
        $wp_rewrite->rules = $IIIIIIIII1ll + $wp_rewrite->rules;
    }
...
add_action ( 'generate_rewrite_rules', 'm_snap_generate_rewrite_rules' );

Any ideas to correct?

0

There are 0 best solutions below