0

How to call get_template_part() with custom permalink, I use childTheme from twentytwelve. In my theme I want to call popular post with get_template_part().

ex. If I call link http: //domain.com/popular I want to show file popular.php (location: childtheme-name/popular.php)

please help.

0

Mapping of URL directly to a template file you describe (mapping URL to a file) is quite rare technique in WordPress, sometimes called static pages.

It is rare because in general that's not how WordPress works. It works by mapping URL to query variables to WP_Query to template hierarchy to template file. Going from URL to a file skips a lot of mandatory steps.

The low key implementation would be to create a page and make your file a custom page template for it.

The more direct implementation is also possible, but you would have to both build a custom rewrite rule and implement processing it from scratch.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.