WordPress.org

Support

Support » Plugins and Hacks » Query Multiple Taxonomies » [Resolved] Base_url in combination with archive-{post-type} and no matches.

[Resolved] Base_url in combination with archive-{post-type} and no matches.

Viewing 2 replies - 1 through 2 (of 2 total)
  • If somebody might have the same issue as I had. I managed to solve it. I changed (‘cpt’ == get_post_type() to is_archive(‘cpt’) and it worked. (and removed the double statements…)

    Forget above. That doesn’t work. A managed to get it working with this code:
    function my_qmt_base_url() {
    $url = ‘http://’ . $_SERVER[‘SERVER_NAME’] . $_SERVER[‘REQUEST_URI’];
    if (false !== strpos($url,’cpt-1′)) {
    $base = ‘../cpt-1’;
    } else if (false !== strpos($url,’cpt-2′)){
    $base = ‘../cpt-1’;
    }
    return $base;
    }

    If you use cpt’s with an archive-page like archive-cpt.php the above code searches for the cpt name in the current page url. When there is a match the base_url gets the name of the cpt. The categories can’t contain the name of to avoid a match on a page with different cpt.

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Base_url in combination with archive-{post-type} and no matches.’ is closed to new replies.
Skip to toolbar