Advertisement
Guest User

Untitled

a guest
Aug 31st, 2015
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
PHP 1.52 KB | None | 0 0
  1. function CopyFile() {
  2.  
  3.       $TemplateFileSourceURL = __DIR__ . '/pag-portafolio.php'; // Address to your file in the plugin directory
  4.       $TemplateFileTargetURL = get_stylesheet_directory() . '/page-pag-portafolio.php'; // Note the "page-" prefix, it is necessary for WP to select this file instead of the general "page.php". The name after the prefix must match the slug of the page created in WP.
  5.  
  6.       if ( !file_exists( $TemplateFileSourceURL ) ) {
  7.         return FALSE;
  8.       }
  9.  
  10.       $GetTemplate = file_get_contents( $TemplateFileSourceURL );
  11.       if ( !$GetTemplate ) {
  12.         return FALSE;
  13.       }
  14.  
  15.       $WriteTemplate = file_put_contents( $TemplateFileTargetURL, $GetTemplate );
  16.       if ( !$WriteTemplate ) {
  17.         return FALSE;
  18.       }
  19.  
  20. $TemplateFileSourceURL = __DIR__ . '/single-portafolio.php'; // Address to your file in the plugin directory
  21.       $TemplateFileTargetURL = get_stylesheet_directory() . '/page-single-portafolio.php'; // Note the "page-" prefix, it is necessary for WP to select this file instead of the general "page.php". The name after the prefix must match the slug of the page created in WP.
  22.  
  23.       if ( !file_exists( $TemplateFileSourceURL ) ) {
  24.         return FALSE;
  25.       }
  26.  
  27.       $GetTemplate = file_get_contents( $TemplateFileSourceURL );
  28.       if ( !$GetTemplate ) {
  29.         return FALSE;
  30.       }
  31.  
  32.       $WriteTemplate = file_put_contents( $TemplateFileTargetURL, $GetTemplate );
  33.       if ( !$WriteTemplate ) {
  34.         return FALSE;
  35.       }
  36.  
  37.       return TRUE;
  38.     }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement