The best way to add PHP pages in WordPress to Page Template in the child-theme folder.

  • Custom WP

Create a file named template-mypage.php and put it in /wp-content/themes/my-theme/.

/*
* Template Name: Custom Page Template 
* Custom template used for custom php code display 
* @package Portafolio WordPress Theme 
* @author Custom WordPress
* @copyright Copyright https://customwp.dev/ 
* @link https://customwp.dev/ 
*/ 


 get_header(); 



// You must call header and footer in this file

  ... here goes your html or php code, wordpress loops ....





get_footer(); 

// You must call header and footer in this file

Custom Custom Page WordPress
WordPress