vendredi 11 novembre 2016

Setup local environment for site that has Wordpress and theme files in separate subdirectories?

I'm at a total loss here. I've never seen a Wordpress site setup with the wp-content files and the wordpress install files in separate sub-directories. Here's a snapshot of the root directory so you can see the file directories. The content folder includes the parent and child theme, and the wp folder includes the wordpress install.

snapshot of directory

I'm using a MAMP as my local environment, and I've grabbed the live site files via SFTP. At the root of the directly is an .htaccess file, local-config.php and wp-config.php. For my local setup, I want to host this site at localhost:8888/{ project name }, however the config files aren't connecting for me.

This is what local-config.php includes:

<?php

 /* This is a sample local-config.php file In it, you *must* include
 the four main database defines

 You may include other settings here that you only want enabled on your
 local development checkouts
 */

 // Must have a trailing and leading slash // define('WP_SUBURI',
 '/mysite/');

 define( 'DB_NAME', 'icecreamstore_wp' ); define( 'DB_USER', 'root' );
 define( 'DB_PASSWORD', 'root' ); define( 'DB_HOST', 'localhost' );

 // Comma separated list of hostnames which should be considered
 "local" // and re-written to $_SERVER['HTTP_HOST']. Also addresses
 wp-content => content replacement. define( 'PATHFIX',
 'local.icecreamstore.maine.edu, icecreamstore.maine.edu'
 );

 // WP_ENV sets the environment to be used by the wp-env MU plugin //
  defined( 'WP_ENV', 'development' );

 // Maintenance mode using the maintenance mu-plugin // define(
 'MAINTENANCE', false); // define( 'MAINTENANCE', true); // define(
 'MAINTENANCE', '<h1>Custom message</h1><p>For maintenance mode</p>');

 // $table_prefix = 'wp_';

 // If the keys are defined here, they will not be loaded in
 wp-config.php

 { security and authentication below this line... }

And the wp-config.php site includes:

 <?php
 // ===================================================
 // Load database info and local development parameters
 // ===================================================
 if ( file_exists( dirname( __FILE__ ) . '/local-config.php' ) ) {
   include( dirname( __FILE__ ) . '/local-config.php' );
 }

 // ========================
 // Security
 // ========================
 if ( !defined('DISALLOW_FILE_EDIT') )
   define('DISALLOW_FILE_EDIT', TRUE);
 if ( !defined('DISALLOW_FILE_MODS') )
   define('DISALLOW_FILE_MODS', FALSE);

 // ========================
 // Custom Content Directory
 // ========================
 define('WP_CONTENT_DIR', dirname( __FILE__ ) . '/content' );

 if ( !defined('WP_SUB_URI') )
   define('WP_SUBURI', '/');

 define('WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . WP_SUBURI   . 'content' );

 /** dynamically set siteurl and home options */
 define('WP_SITEURL', 'http://' . $_SERVER['HTTP_HOST'] . WP_SUBURI . 'wp');
 define('WP_HOME',    'http://' . $_SERVER['HTTP_HOST'] . WP_SUBURI);

 { security and authentication below... }

And just in case it helps, the .htaccess at the root includes:

 # BEGIN WordPress
 <IfModule mod_rewrite.c>
 RewriteEngine On
 RewriteBase /
 RewriteRule ^index\.php$ - [L]
 RewriteCond %{REQUEST_FILENAME} !-f
 RewriteCond %{REQUEST_FILENAME} !-d
 RewriteRule . /index.php [L]
 </IfModule>

 # END WordPress

Help! I haven't found anyone online with this particular issue of having to take a live site setup this way, and create a local environmnet for testing. The downside: The previous developer didn't include anything in the README.md docs.

Aucun commentaire:

Enregistrer un commentaire