How to make pagination in WordPress headings?

There is a file which displays posts otnosjatsja to specific headings.
The contents of the file: https://pastebin.com/wL0E1gxC

Tried a lot of things, but the button is either not displayed or displayed but clicking on them tossed on site.ru/catalog/test/page/2 and gave a 404 error, or just when you click the URL changed, but the displayed positions remained the same
April 2nd 20 at 17:43
0 answer

Find more questions by tags WordPress