• I am trying to have a sort by dropdown that will work when I am using the post types order plugin but cant seem to get it to work. One of options is also a custom field.

    <?php
      $order = "&order=DESC";
      if ($_POST['select'] == 'tag') { $order = "&tag=mytag";  }
      if ($_POST['select'] == 'title') { $order = "&order=ASC&orderby=title";  }
      if ($_POST['select'] == 'newest') { $order = "&order=DESC"; }
      if ($_POST['select'] == 'oldest') { $order = "&order=ASC";  }
      if ($_POST['select'] == 'r_weekly_rate_from') { $order = "&order=ASC&orderby=meta_value_num";  }
    ?>
    <form method="post" id="order">
      Sort reviews by:
      <select name="select" onchange='this.form.submit()'>
        <option value="tag"<?php selected( $_POST['select'],'tag', 1 ); ?>>Tag</option>
        <option value="title"<?php selected( $_POST['select'],'title', 1 ); ?>>Title</option>
        <option value="newest"<?php selected( $_POST['select'],'newest', 1 ); ?>>Newest</option>
        <option value="oldest"<?php selected( $_POST['select'], 'oldest', 1 ); ?>>Oldest</option>
        <option value="r_weekly_rate_from"<?php selected( $_POST['select'],'r_weekly_rate_from' , 1 ); ?>>Weekly Rate</option>
      </select>
    </form>
    <?php query_posts($query_string . $order); ?>
Viewing 1 replies (of 1 total)
  • Plugin Author nsp-code

    (@nsp-code)

    Try to include ignore_custom_sort within $query_string, i suggest to set it as an array instead, so you will use something like this:

    $query_string = array(

    ‘ignore_custom_sort’ => TRUE
    // your other parameters , eg sort
    )

Viewing 1 replies (of 1 total)
  • The topic ‘Sort By Dropdown’ is closed to new replies.