Forum Replies Created

Viewing 9 replies - 1 through 9 (of 9 total)
  • @designsandcode Any idea why this is not working?

    Actually, never mind that. I misunderstood the foreach function….

    I did some research,

    foreach (array_expression as $value)
    statement
    foreach (array_expression as $key => $value)
    statement

    So I guess that means there should be a value defined for $tax_param? I searched the php file, it’s not defined. So i did a var_dump($tax_param). What I got is

    NULL string(8) “player04” string(5) “age08”

    Any idea what that means?

    Here’s the foreach function again.

    foreach($tax_params as $tax_param)
    						{
    							$tax = get_term_by("slug",$tax_param, $key);
    
    							if(isset($tax->term_id))
    							{
    								$taxs[] = $tax->term_id;
    							}
    						}

    Yes. I still get the error ??

    This is what I got after placing var_dump($tax_params); before the foreach line

    array(1) { [0]=> string(8) “player04” } array(1) { [0]=> string(5) “age08” } array(1) { [0]=> string(6) “time30” }

    Hi Mikko,

    Thanks for asking!

    After some further testing, I found out that Relevannsi is actually working fine with this plugin. The problem probably has to do with the plugin.

    Here’s what the problem is:
    In this first image, you can see that I’ve entered a keyword, set filters for age=8, player number = 4, and game time = 30min.

    View post on imgur.com

    The second image shows the search result. The result is correct, only one article meets the query. However, the problem is it no longer shows all the filters I set. It only shows player number = 4, whereas age and game time displays the default values.

    View post on imgur.com

    Possible reason for the error:
    This page was created by pasting the Search and Filter shortcode into a Page.

    The shortcode is the following:

    [searchandfilter fields=”search,category,cs_playernum,cs_age,cs_gametime,cs_publishyear,cs_editorrating” order_dir=”,,asc,asc,asc,asc,asc” order_by=”,,id,id,id,id,id” types=”,,select,select,select,select,select” hierarchical=”,1,,,,,” headings=”關鍵字,分類,玩家人數,年齡,遊戲時間,出版年份,編輯評分” submit_label=”搜尋”]

    The “cs_….”s are custom categories I created using the WP-type plugin.

    When I saved/updated the page, I get the following Warnings;

    Warning: Invalid argument supplied for foreach() in /home/boardgam/public_html/wp-content/plugins/search-filter/search-filter.php on line 1153

    Warning: Cannot modify header information – headers already sent by (output started at /home/boardgam/public_html/wp-content/plugins/search-filter/search-filter.php:1153) in /home/boardgam/public_html/wp-admin/post.php on line 233

    Warning: Cannot modify header information – headers already sent by (output started at /home/boardgam/public_html/wp-content/plugins/search-filter/search-filter.php:1153) in /home/boardgam/public_html/wp-includes/pluggable.php on line 1173

    search-filter line 1153 starts at foreach

    //loop through all the query vars
    
    			foreach($wp_query->query as $key=>$val)
    
    			{
    
    				if(!in_array(SF_FPRE.$key, $this->frmqreserved))
    
    				{//make sure the get is not a reserved get as they have already been handled above
    
    					//now check it is a desired key
    
    					if(in_array($key, $this->taxonomylist))
    
    					{
    
    						$taxslug = ($val);
    
    						//$tax_params = explode("+",esc_attr($taxslug));
    
    						$tax_params = (preg_split("/[,\+ ]/", esc_attr($taxslug))); //explode with 2 delims
    
    						foreach($tax_params as $tax_param)
    
    						{
    
    							$tax = get_term_by("slug",$tax_param, $key);
    
    							if(isset($tax->term_id))
    
    							{
    
    								$taxs[] = $tax->term_id;
    
    							}
    
    						}
    
    						$this->defaults[SF_FPRE.$key] = $taxs;
    
    					}
    
    				}
    
    			}

    post.php line 233 is setcookie(….. in

    // Session cookie flag that the post was saved
    	if ( isset( $_COOKIE['wp-saving-post'] ) && $_COOKIE['wp-saving-post'] === $post_id . '-check' ) {
    		setcookie( 'wp-saving-post', $post_id . '-saved', time() + DAY_IN_SECONDS );
    	}

    and pluggable.php line 1173 is header(…. in

    if ( !function_exists('wp_redirect') ) :
    /**
     * Redirects to another page.
     *
     * @since 1.5.1
     *
     * @param string $location The path to redirect to.
     * @param int $status Status code to use.
     * @return bool False if $location is not provided, true otherwise.
     */
    function wp_redirect($location, $status = 302) {
    	global $is_IIS;
    
    	/**
    	 * Filter the redirect location.
    	 *
    	 * @since 2.1.0
    	 *
    	 * @param string $location The path to redirect to.
    	 * @param int    $status   Status code to use.
    	 */
    	$location = apply_filters( 'wp_redirect', $location, $status );
    
    	/**
    	 * Filter the redirect status code.
    	 *
    	 * @since 2.3.0
    	 *
    	 * @param int    $status   Status code to use.
    	 * @param string $location The path to redirect to.
    	 */
    	$status = apply_filters( 'wp_redirect_status', $status, $location );
    
    	if ( ! $location )
    		return false;
    
    	$location = wp_sanitize_redirect($location);
    
    	if ( !$is_IIS && php_sapi_name() != 'cgi-fcgi' )
    		status_header($status); // This causes problems on IIS and some FastCGI setups
    
    	header("Location: $location", true, $status);
    
    	return true;
    }
    endif;

    I’m not a programmer, so I don’t know how these are related and how they might contribute to the problem I have. Any idea?

    Any help will be very much appreciated!!

    Jean

    My search page is at https://www.boardgamelove.com.tw/%E9%80%B2%E9%9A%8E%E6%90%9C%E5%B0%8B/

    Sorry it’s in Chinese!

    I’m having the same problem with Relevanssi. It doesn’t work when I’ve selected more than one category. Is there a fix? or perhaps the Pro version will work?

    Is there currently a fix to the problem with codes showing up?

    thanks!

    Jean

    I’m loving this plugin as well! but i’m having the same trouble with all the functions in the second row of the full editor when a subscriber is logged in. The codes showed up!

Viewing 9 replies - 1 through 9 (of 9 total)