Answer the question
In order to leave comments, you need to log in
How to link to different pages in one template?
There are pages: " product 1 " and " product 2 ".
Each of these pages lists products ("product 1.1", "product 2.1", etc.).
When we go to the "product 1.1" page, we get the following address:
Therefore, when we go to the "product 2.1" page, we get the following address:
On each page ("product 1.1/2.2", etc.) there is a link "back to all products" .
The page template ("product 1.1" and "product 2.2", etc.) is the same. Question:
How to correctly create a "return to all products" link code in wordpress so as not to make two identical templates (files) and not to prescribe the ID of the corresponding category according to the principlehttp://example.ru/товар 1/товар 1.1
http://example.ru/товар 2/товар 2.1
<?php
echo '<a href="' . get_permalink(1) . '">вернуться ко всем товарам 1</a>';
?>
<?php
echo '<a href="' . get_permalink(2) . '">вернуться ко всем товарам 2</a>';
?>
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question