• There are several plugins that support the notion of a “taxonomy”. Some do URL rewriting. But the end result of them seems to be to create virtual pages and things like “tag clouds”.

    I need a way to do a URL rewrite, then pick up the value inside of a regular wordpress page.

    I’ve played with the various taxonomy plugins I’ve found, but I can’t figure out how to get hold of values inside the page, and haven’t found any examples.

    The plugin descriptions, where they explain anything, just show a couple of functions to call. How do you call these functions from within the content of a page?

    (Do you need to use exec_php?)

    I don’t need tag clouds or virtual pages. I just need to be able to take something like this:

    mydomain.com/something/a_page/someid

    and convert it to the equivalent of:

    mydomain.com/something/a_page/?theid=someid

    and then access $theid within the content of the page for a_page.

    Thanks
    -David

Viewing 5 replies - 1 through 5 (of 5 total)
  • What does someid represent and what do you need to do with it?

    Thread Starter desert-rat

    (@desert-rat)

    It’s a standard querystring argument=value pair.

    Here’s a more concrete example:

    I need URLs of this form:

    coolstuff.com/product/prod1234

    to work as if they’re given as:

    coolstuff.com/product?prodid=prod1234

    and I need to be able to access the valued of $prodid (however it’s given) inside the content of the Page that WordPress brings up as

    coolstuff.com/product

    For example, a query to pull up info on the product where prodid=”prod1234″

    Or a form to request more information or pricing and availability regarding that product, where there’s a hidden field, say, that identifies this as product “prod1234”, as taken from the URL.

    -David

    Have you tried defining a ‘product’ custom post type?

    Note that you can’t do everything from “within the page content”. You have to learn a little bit about the template hierarchy too.

    Thread Starter desert-rat

    (@desert-rat)

    I’m not trying to create a taxonomy. I do not want or need custom page templates. I don’t even need custom post types.

    I’m simply trying to find a plugin that comes close to doing what this guy describes:

    https://www.rlmseo.com/blog/passing-get-query-string-parameters-in-wordpress-url/comment-page-1/

    His approach requires you to modify the theme’s function.php file and some other theme-specific stuff. However, putting this logic into a plugin would let you do this with any theme.

    I’ve searched around, and the only plugins I can find that do URL rewriting are SEO plugins and those that help you manage taxonomies.

    Simply put, if I have a URL like this:

    mydomain.com/product/scissors

    It gets rewritten as something like this:

    mydomain.com/product?prod_type=scissors

    Then I can have a Page at:

    mydomain.com/product

    that can pick up the last term “scissors” in a variable like {prod_type} and run a query on it like this:

    select * from products where prod_type = “{prod_type}”

    (The syntax “{xyz}” is hypothetical. It’s just an example.)

    and the page would actually run the query:

    select * from products where prod_type = “scissors”

    There are plenty of places within WordPress that do URL rewriting, like permalinks.

    There are plenty of plugins that do this exact kind of substitution in regular Pages.

    I’m simply looking for a way to rewrite the URL, assigning the last field to a (fixed) variable, and being able to access that variable and its value within a Page.

    Maybe there’s a plugin that does exactly this. But taxonomies are the closest things I’ve found to doing this so far.

    -David

    You won’t find a plugin that does this because it’s not the right way to do it in WordPress.

    The page content is for content. If you need to do other stuff, like SQL queries etc., you should create a custom page template, like the tutorial you mentioned suggests. Here’s how:

    https://codex.www.ads-software.com/Pages#Creating_Your_Own_Page_Templates

    If you really want to have it your way, your best bet is to hire a developer to write a custom plugin for you:

    https://jobs.wordpress.net

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘taxonomy plugin question’ is closed to new replies.