如何字preSS动态URL preFIX根据分类 [英] How to Wordpress dynamic url prefix based on taxonomy

查看:160
本文介绍了如何字preSS动态URL preFIX根据分类的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在开发使用文字preSS的提供网站。我们正在努力提供有关城市不同的优惠。

I'm developing an offers site using wordpress. We are trying to offer different offers regarding the city.

因此​​,我们有两个分类(类别和城市)。

So we have two taxonomies (category and city).

的事情是,我不想使用正常的URL结构,我想这可能是:

The thing is that I don't want to use the normal url structure, I wish it could be:

root -> http://site .com/city-taxonomy 
category -> http://site .com/city-taxonomy/category 
offer -> http://site .com/city-taxonomy/offer-slug

基本上,我要在不使用多个站点(网络)中字preSS,所以我不需要重复类别或自定义字段分割我的网站在城市。我想保持当前的单词preSS网址系统是如何工作的,但增加了preFIX我可以从PHP使用GET读

的,如果有人能做到这一点,我想知道你将如何处理URL创建模板,利用城市为preFIX,全局变量应enoght。

The if anybody manage to do this, I'd like to know how will you handle the url creating in the template, using the city as a prefix, global variable should be enoght.

我想到了创建城市,类别和子类别,但我需要重复所有子类别的每一个。

I thought about creating city as category and subcategories, but I'd need to repeat all the subcategories for each one.

一个报价可以包括在几个城市和一类。

One offer could be included in several cities and one category.

我readed有关Word preSS PHP重写规则的功能,但我认为这应该是更快,如果我这样做htaccess的。

I readed about the rewrite rules functions in wordpress php but I think it should be faster if I do this in htaccess.

的事情是,包括像一个规则后:

The thing is that after including a rule like:

RewriteRule ^([^/]+)/? index.php?city=$1 [L]

这始终是我重定向搜索功能中字preSS,我不知道这是不是一个很好的长期解决方案。

This is always redirecting me to search functionality in wordpress, and I don't know if this is a good long term solution.

我只是需要有这样的第一个参数,以便设置一个全局变量,所以我可以修改数据库的请求,URL的其余部分应该在同一个词preSS在做什么。

我们可以说是相同的功能的语言是干什么的,增加了preFIX的URL,这样就可以判断的语言,但我不知道如何实现

We could say is the same functionality "language" is doing, adding a prefix to the url so you can determine language, but I don't know how to implement that

谢谢!

推荐答案

您可以试试这个:

从你的仪表板设置 - >固定链接,然后选择发布名称从那里。

From your dashboard Go to Settings->Permalinks and select post name from there.

这篇关于如何字preSS动态URL preFIX根据分类的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆