Make Wordpress direct an access to a PHP file in the theme

Asked

Viewed 50 times

0

I have the following need:

I have some pages called "Diagnostics" on my site in Wordpress. However, the standard features of WP do not allow to do what I wish. I need to do some calculations on these diagnostics, and I can do them outside of WP, with even common PHP.

However, how can I get WP to direct, for example, the "/diagnoses/diagnose-de-processes" page to the /wp-content/themes/meutema/diagnostico-de-processes.php"?

  • <?php echo get_template_directory_uri() ?>/diagnostico-de-processos.php

  • @Valdeirpsr this section should be inserted where? As far as I know, this get_template_directory_uri just brings me the path to the theme. That’s not what I need.

1 answer

1


You just create one page template with the file "diagnostico-de-processos.php". You just need to put the following comment at the beginning of the file:

/**
 * Template name: Página de Diagnósticos
 */

On the panel of wordpress you edit the "/diagnoses/diagnose-de-processes" page and select the template: Page of Diagnostics. So the wordpress will understand that you will use the file "diagnostico-de-processes.php" to render the desired page.

  • 1

    PERFECT! Thank you very much, Kayo!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.