G
G
Genri_Rus2020-05-16 19:11:35
WordPress
Genri_Rus, 2020-05-16 19:11:35

Is it possible to somehow bind the page template to post_type records?

I created a photo archive page with a template-photo.php template, in it, using the WP_Query loop, I displayed post_type=photo
5ec00e6051c30007648726.png

When I click on the photo, I should open a gallery on the next page:

5ec00ecf39c8b670658667.png

But the problem is that in my url line: http://название сайта/?post-photo=victor-ql-y44f

And how to make it so when you go to the record?

http://название сайта/photo/victor-ql-y44f

Those. the photoarchive page could display not only previews of entries, but also expanded (for each entry) a full-fledged gallery?

Answer the question

In order to leave comments, you need to log in

1 answer(s)
G
Genri_Rus, 2020-05-16
@Genri_Rus

In general, I figured out that when registering a post type, you need to specify the following settings:

register_post_type('custom_name', array(
   'rewrite' => array( 'slug' => 'name_slug' ),
));

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question