WordPress.org

Ready to get started?Download WordPress

Forums

Cat + Tag Filter
[resolved] HELP URGENT - Error in parameters wrong url (5 posts)

  1. mboratto@gmail.com
    Member
    Posted 2 years ago #

    I am using the plugin at page http://www.guiagcr.com.br/estabelecimentos/ but when i do a search selecting both "Any tag" and "Any category" these generates a wrong url. HELP ME PLEASE!

  2. ajayver
    Member
    Plugin Author

    Posted 2 years ago #

    When you choose Any tag + Any category the filter is disabled and generates a normal link to your homepage. Choose some tag or category to test the filter.

  3. mboratto@gmail.com
    Member
    Posted 2 years ago #

    When a category and a tag is selected it works, but when i choose any tag + any categ i have to do the following tweak:

    if( $cat == -1)
    {
    	$url = $_POST["home_url"] . $tag;
    }
    else
    {
    	$url = $_POST["home_url"] . $cat . $tag;
    }
    
    if( ($cat == -1) and ($tag == -1) )
    {
    	$url = "http://www.guiagcr.com.br/estabelecimentos/";
    }
    elseif( ($cat != -1) and ($tag == -1) )
    {
    	$url = "http://www.guiagcr.com.br/estabelecimentos/";
    }
  4. mboratto@gmail.com
    Member
    Posted 2 years ago #

    this because the orginal was generating urls with numbers characters like like:

    http://www.guiagcr.com.br-1-1

    instead

    http://www.guiagcr.com.br

  5. JacklineoMary
    Member
    Posted 2 years ago #

    same mboratto@gmail.com only working with Required choose cata + tag. If you choose:
    + Only cata no choose tag: not work.
    + Only Tag no cata: not work.
    + No tag no cata : not work.
    Now you can fix it by:
    Replace the code below

    if ($_POST["ctf_submit"] == 1) {
    if ($_POST["cat"] != -1) {$cat = '/?category_name=' . $_POST['cat'];
    if ($_POST["tag"] != -1) $tag = '&tag=' . $_POST["tag"];}
    else {if ($_POST["tag"] != -1) $tag = '/?tag=' . $_POST["tag"];}
    $url = $_POST["home_url"] . $cat . $tag;
    header('Location: ' . $url);
    }

    By code :

    if ($_POST["ctf_submit"] == 1) {
    	if ($_POST["cat"] != -1) {
    		$cat = '/?category_name=' . $_POST['cat'];
    		if ($_POST["tag"] != -1) {
    			$tag = '&tag=' . $_POST["tag"];
    			$url = $_POST["home_url"] .$cat . $tag;}
    		else
    			{$url = $_POST["home_url"] .$cat;}
    		}
    		else {
    			if ($_POST["tag"] != -1) {
    				$tag = '/?tag=' . $_POST["tag"];
    				$url = $_POST["home_url"] . $tag;}
    			else
    				{$url = $_POST["home_url"];}
    			}
    	header('Location: ' . $url);
    }

    If ajayver visit this thead please fix send fix to everyone.
    Thanks you!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic