N
N
Nastya2020-02-27 13:37:29
PHP
Nastya, 2020-02-27 13:37:29

How to assign a post of a custom type as the parent page of a post of another custom type, or what to do if you have no experience and half the brain?

Hello! I ask the Greats for help)

Thanks to the register_post_type () function, I have three arbitrary post types: Names, Offers, Experience. Taxonomies by category type are registered for Offer and Experience. How to get nested url like Site/Name/Offers/Category/Post-offer and Site/Name/Experience/Category/Post-experience? In Offers and Experience, I can only assign pages of the same type as the parent page. How to overcome it?

I'm confused, I'm all lost.

As a result, I should also have pages Names with all names (i.e. url of the type Site / Names and Site / Names / Name), Offers with all offers and the ability to select a category (i.e. url of the form Site / Offers and Site /Offers/Category), Experience - as in Offers. It worked, but what about the nesting of the url from the question? Now I display both Offers and Experience on the Site / Names / Name page (I connected through arbitrary fields Names and Offers and Names and Experience), the final url is obtained in the form Site / Offers / Post-Offer (similarly with Experience). But I need it differently, as in the first paragraph ...

Tell me please, maybe you need to think in the other direction? How to put it all together?

Well, I re-read it and got upset - it’s not logical, because if a visitor went, for example, to an Offer Post that has a url like Site/Name/Offers/Category/Offer Post from the Site/Offers/Category page. Actually, I don't think anymore. Mess in my head. And sawdust.

Please save the stupid me. How to organize? Where to read?

Please do not swear too much - I'm completely new to website building ...

Answer the question

In order to leave comments, you need to log in

4 answer(s)
R
Rsa97, 2019-07-08
@IwanQ

Do you distinguish colors? Even here in the text of the question, the error is clearly highlighted - in the second line, the quotation mark and bracket are not closed.

L
Lord_Dantes, 2020-02-27
@Lord_Dantes

Porridge

I started reading and remembered that my project is not that complicated...
Why am I here.. what is your task or structure? Nothing is clear from the description.

V
Vladimir Druzhaev, 2020-02-28
@OtshelnikFm

or what to do in the absence of experience and half the brain?

Get freelancing. All you need is money and a brief description of the task. Which will be pulled out of you You
write a lot of water. Try to be concise, without water and "snot".
Service rules https://qna.habr.com/help/rules

N
Nastya, 2020-03-27
@Chupizdik

I thought for a long time ... But I came up with it) It may be completely wrong, but the logic is this. For each "Name" I made child pages "Offers" and "Experience" with separate templates; using add_rewrite_tag,
add_permastruct, and add_rewrite_rule, made the references for records of type Offers and Experience to the form Site/Names/Name/Offers/Category/Sentence Post and Site/Names/Name/Experience/Category/Experience Post. As a result, I got the necessary working structure and a bunch of duplicates) But this is a completely different story, the question about duplicates with my code is here

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question