R
R
Roman Savitsky2016-11-01 21:03:20
htaccess
Roman Savitsky, 2016-11-01 21:03:20

Generate your post link if the data is taken from a custom plate in the Wordpress database?

Welcome all !
I created a custom table in the WP database, I enter data into it
On the WP page, through global wpdb;I display a list of my records from this table, I’m interested in such a question, How to make it so that I can generate a link to each of the records and there was a template file to display all the content of this record
A format links was such maindomen.com/tovar/nazvanije-mojej-zapisi
Thank you all in advance!

Answer the question

In order to leave comments, you need to log in

2 answer(s)
I
Igor Vorotnev, 2016-11-02
@PRC

You can make a beautiful URL and its handler, but first the main and main question - why exactly a separate table? IMHO, you can (and should) get by with a standard table (tables), creating your own is already straight for special cases.
UPDATE:
If you really really want to go this way (although I strongly advise against it), remember that almost all functions related to WP_Query, request, etc. will not work for you - you will have to write your own. In general, almost any familiar WP bun will work incorrectly or not work at all.
1. First we make urls - for this we add all the necessary schemes using add_rewrite_rule()
2. Next we write handlers for these urls (those that will contain your $matches[x])
3. Next, we write helper functions - to generate urls and insert them into the content, for pagination, etc.
4. Next, hook into template_include and include the necessary templates
cursed and all the rest of the functionality worked
6. Well, saw the admin panel with handles.
You can try to file your custom WP_Query, something like My_Query, based on the native one. But, as I already wrote in the comments, these are dances with a tambourine that do not make any sense. Make a regular custom post type for your products, create taxonomies for it, add custom fields using Advanced Custom Fields Pro, and don't look for problems on your fifth dot, from scratch. From your comments, I never saw an objective reason to use my table. If you are worried that the database will be large and stupid - in vain, properly prepared WP flies, and 30 + 15k records is nothing. If you have a lot of product characteristics and you are afraid that they will be stupid in the form of meta_query in filters - there is Elastic Search for this. Well, or at the very least, put the characteristics themselves in a separate table,see here for an example )

N
Nikolai Bazhenov, 2016-11-02
@Nikolaj80

I am interested in the semantic core for the informant, which I want to create by loading all the keys into the database, and automatically generating pages on WordPress.
On this side, does anyone know the implementation for the site? I did not find plugins for these purposes.

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question