• Help me please.
    I create two query_var but I have not idea for this. because this isn’t working. pq-modem.php is for general category, pq-modem2.php is for specific category.
    I know this case will done by using conditional if query based on category. But the problem is I don’t know how to do it.
    This the code I use until now.

    function sjc_add_query_vars($vars) {
        return array('modem') + $vars;
    }
    add_filter('query_vars', 'sjc_add_query_vars');
    
    function streaming_template($template) {
      global $wp;
      if ($wp->query_vars['modem']=='price_quality') {
        return dirname( __FILE__ ) . '/pq-modem.php';
      }elseif ($wp->query_vars['modem']=='price_quality') {
        return dirname( __FILE__ ) . '/pq-modem2.php';
      }
      else {
        return $template;
Viewing 1 replies (of 1 total)
  • function sjc_add_query_vars($vars) {
    return array(‘modem’) + $vars;
    }
    add_filter(‘query_vars’, ‘sjc_add_query_vars’);

    I think you can found the error in sjc_add_query_vars what was the return in array(‘modem’) + $vars? where the ‘modem’ came from in inside of a function sjc_add_query_vars? Then, what having the purpose of if elseif statement if they are the same condition ask? Where the $template goes if the conditions are credited?

Viewing 1 replies (of 1 total)
  • The topic ‘Help me with Query_Var’ is closed to new replies.