Giter VIP home page Giter VIP logo

wordpress-skeleton's Introduction

WordPress Skeleton

This is simply a skeleton repo for a WordPress site. Clone it to jump-start your WordPress site repos, or fork it and customize it to your own liking!

Assumptions

  • WordPress as a Git submodule in /wp/
  • Custom content directory in /content/ (cleaner, and also because it can't be in /wp/)
  • wp-config.php in the root (because it can't be in /wp/)
  • All writable directories are symlinked to similarly named locations under /shared/.

Questions & Answers

Q: Will you accept pull requests?
A: Maybe — if I think the change is useful. I primarily made this for my own use, and thought people might find it useful. If you want to take it in a different direction and make your own customized skeleton, then just maintain your own fork.

Q: Why the /shared/ symlink stuff for uploads?
A: For local development, create /shared/ (it is ignored by Git), and have the files live there. For production, have your deploy script symlink /shared/ to some outside-the-repo location (like an NFS shared directory or something). This gives you separation between Git-managed code and uploaded files.

Q: What version of WordPress does this track?
A: The latest stable release. It should automatically update within 6 hours of a new WordPress stable release. Open an issue if that doesn't happen.

Q: What's the deal with local-config.php?
A: It is for local development, which might have different MySQL credentials or do things like enable query saving or debug mode. This file is ignored by Git, so it doesn't accidentally get checked in. If the file does not exist (which it shouldn't, in production), then WordPress will use the DB credentials defined in wp-config.php.

Q: What is memcached.php?
A: This is for people using memcached as an object cache backend. It should be something like: <?php return array( "server01:11211", "server02:11211" ); ?>. Programattic generation of this file is recommended.

Q: Does this support WordPress in multisite mode?
A: Yes, as of WordPress v3.5 which was released in December, 2012.

wordpress-skeleton's People

Contributors

acharlieh avatar cliffordp avatar djallits avatar jasonmccreary avatar markjaquith avatar rarst avatar rfair404 avatar thenbrent avatar victormoukhortov avatar xelance-com avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

wordpress-skeleton's Issues

Question: Multisite, local (XAMPP) install

Hi,
Please accept my apologies in advance if this has been covered in previous questions. I have attempted other fixes listed here but am still having issues getting WP Multisite to work.
I have an existing site set up with this WordPress skeleton in XAMPP. I would like to change this existing site to use multisite. I am getting conflicting messages about whether to use the sub-directory or sub-domain option, what additional code to include in my .htaccess file to make multisite work with WP Skeleton, and whether or not to have the trailing /wp in the site address setting.
I have attempted changing the existing site, and also creating a blank site with WP Skeleton. Both times, once I have made the config changes to wp-config.php and .htaccess, logged out, cleared my cookies and browser cache, and logged back in, I do not see any change in my WP dashboard that indicates I am now running a Multisite site.
Tell me if I'm asking too much, but is it possible to have a guide to set up multisite with the skeleton?
Thanks in advance :)

Lacking upload permissions when on localhost?

I'm using the WordPress Skeleton with WordPress 3.7.1. I also used the fix from this comment for my .htaccess so as to not have to type in /wp to access everything. Whenever I try to upload any media, however, I get this error:

Unable to create directory uploads/2013/11. Is its parent directory writable by the server?

I'm working in Mac OS X Mavericks. Anyone know what might be wrong, here?

Merge Conflicts updating wp submodule

Greetings,

I tried to do a "git pull origin master" from the wp submodule folder and got a log of merge conflicts. As we haven't updated any of the files locally, the source of these conflicts is unclear. Anyone else see this?

What is the easiest way to update the WordPress Git submodule on server after deploy?

Question

What is the easiest way to update the WordPress Git submodule directory on a server after deploy?

Background

I have forked this repo and used it to develop a WordPress Multisite instance.

I just set up Capistrano V3+ to deploy my WordPress Skeleton based site to my server, as recommended by Mark Jaquith.

The problem is that my WordPress submodule is not included as part of the standard Capistrano V3+ deploy. There are many different StackOverflow answers as to how to fix this in Capistrano, all of them fairly hacky...

However, it strikes me that it would be just as easy to manually update the WordPress submodule on my server, until Capistrano V3+ is updated to enable deployment of Git submodules...

Or is there an easier, more straightforward way to update the WordPress submodule on a server after deploy?

Multisite redirect loop

Hi,

This is my situation:

  • I installed Wordpress Skeleton
  • Activated Multisite
  • Added the provided code to .htaccess, wp-config.php
  • Added a second website.

If I click Websites > Second Website > Dashboard it says there is a redirect loop. Is it possible to use multisite with skeleton? Would be awesome if you could explain how :)

Cannot set up normal URL structure local install

After your talk at #wcsf I decided to give WordPress Skeleton a try. I have a local version of a LEMP stack running. I realized that I needed to get the WP files (since they weren't there) so I cloned them from the latest.tar.gz file. I then went to set up local-config.php to my local server's mysql credentals.

When I go to setup the install, it cannot find /wp-admin/install.php because it's located in /wp/wp-admin/install.php. If I go to the ladder and set up WordPress, it works, but now the site is accesable at localhost/parkers and localhost/parkers/wp and I can only log in at the /wp/wp-admin url.

I feel like I am missing something big, but I cannot see it from the instructions set in the README. I'd appreciate any help.

Zach

Update to WP 3.8

Wordpress 3.8 is now available. Submodule should reflect this 👍

Problem setting up mod_rewrite/permalinks

Hi,
I am having trouble configuring "pretty URLs" with WordPress skeleton. Any advice would be much appreciated.

This is the link I am trying to access:
http://projects/WordPress-Skeleton/wp/hello-world/

I am a bit confused, shouldn't it really be without the "wp" part?
http://projects/WordPress-Skeleton/hello-world/

Database:

  • Where should HOME and SITE_URL point?

.htaccess:

  • Should there be 1 in the Skeleton folder and 1 in the WP folder?
  • What should it/they contain?

wp-config.php / local-config:

  • Anything I need to modify here?

Automatic Background Updates: Thoughts?

@markjaquith,

Automatic Background Updates

For WordPress 3.7+, you don’t have to lift a finger to apply minor and security updates. Most sites are now able to automatically apply these updates in the background. If your site is capable of one-click updates without entering FTP credentials, then your site should be able to update from 3.7 to 3.7.1, 3.7.2, etc. (You’ll still need to click “Update Now” for major feature releases.)

Based on my research, the auto updates won't happen if it's a git project.

With that said, it seems like this might open the doors up to WP developers updating WP more often (especially for small fixes).

Do you have any thoughts/plans on how to handle this? Or, how do you suggest folks handle this? Would it just be a matter of updating the submodule more often (assuming that there will be more frequent updates)?

Do you have plans to change your setup based on the advent of automatic updates?

Just curious what your thoughts are more than anything.

Thanks!

Lies, damned lies, and readme files

Q: What version of WordPress does this track?
A: The latest stable release. Send a pull request if I fall behind.

The current version is neither the latest nor stable.

Could Salts Live In Another File?

I sort of want to be able to put this whole repository publicly, to show how one can use submodules to manage most of plugins out there.

Your lovely Capistrano stack will allow me to specify the passwords there and overwrite them on deploy. Could we do the same for the salts also?

Thanks a lot!

Page Not Found after cloning to live server

hi, im done with my localserver so im ready to push it live so i push it to my repo then clone it to my live server ssh using --recursive after that i access my domain subdir where i clone my repo and its said "Page Not Found" all files are there except local-config.php, do you think i did something wrong?

but one thing i notice is when i clone it to my live server it said "Initialized empty Git repository"

Admin bar won't appear on front-end

As long as I keep the site address as mydomain.com/wp, it appears. But once I change it to simply mydomain.com (and keep the WordPress Address as mydomain.com/wp), the Admin bar doesn't appear anymore on the front-end.

Themes that have a built-in gutter for when the admin bar should be displaying continue to show the gutter, just no admin bar. (See attached). I've tested this behavior in a copy of the Twenty Thirteen theme as well.

Anyone else getting this, or have any idea what might be going on?

screen shot 2013-12-10 at 5 53 45 am

Multisite note

Not an issue actually, just a note about Multisite + WordPress in own directory. I think it should be clearly stated in FAQ section of README. Knowing it before would save me some 2 hours :)

WordPress Multisite works well when WP is installed in it's own directory. However, there's one limitation. As stated on Codex:

You cannot choose Sub-domain Install (for a domain-based network) in the following cases:

  • The WordPress URL contains a path, not just a domain. (That is, WordPress is not installed in a document root, or you are not using the URL of that document root.)

So, in practice WP Skeleton (or any other way of using WP in it's own directory) is only compatible with a sub-directory setup of WP Multisite.

blank page

hi, i create a repository and for it and clone to my local folder. create database . create local-confi.php and change to name of database, root,root, localhost. change the path to
define( 'WP_CONTENT_URL', 'http://' . $_SERVER['HTTP_HOST'] . '/wp-skeleton-test1/content' );

but now when i go to localhost/wp-skeleton-test1/wp/wp-admin i a have just blank page.

using MAMP and apache port 80 and mysql port 3306

i tried everything with the path but not working. please help

Environment Configurations

I am starting to question if not using ENVVARS would be a better way to manage Environment specific variables within the Skeleton. I am just looking for a friendly discussion on this. Pros and Cons.

/xmlrpc.php?rsd

This absolute path is used by the WP iOS app.
WP Skeleton puts this in /wp/xmlrpc.php?rsd
Do you know if there's a workaround for this? Wondering if a symlink might be the way to go.

Error establishing a database connection on local MAMP

just a quick question but when i install this on my local system and go to the route it does not start the wordpress installation but display the dreaded error establishing db connection.
Therefore do i need to create the database and all the tables for a site manually or is there an automatic way of doing this using this skeleton setup?

smpl-skeleton

After I changed domain from test one to proper one I have issue with customizator. I can;t set up logo or background. When I choose image from computer, nothing is done. Logo is not loaded. No action is done. I checked all what I could and can;t find solution. On my computer it is working fine. I don;t know if this can be the specyfic server problem or something else? What shoudl I check?

WP_CONTENT_URL being set as servers internal IP address

This could potentially be a bug with how I had nginx setup.

Using the skeleton recently on a dual server setup, behind a load balancer, very randomly, we'd get the site url being set as the servers internal IP address. Only on say 1 or 2 items in the loop. 95% of the site was perfect.

@jdub worked out that it was the following

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

being set wrong.

Again, it feels like a nginx issue, and it not passing the correct host through... To solve quickly, I updated my WP_CONTENT_URL constant to

define( 'WP_CONTENT_URL', WP_HOME . '/wp-content' );

Just posting in case others have hit this problem before or in the future.

FTP Connection

Is there any way around having to manually enter your FTP info to install plugins or update WP from the admin?

I can't seem to fix that WP feature with permissions.

What does "%%" mean in config file?

Sorry, I'm probably missing something obvious here, but what is the meaning of the %% in the config strings? Is this syntax just meant to be replaced by real values? Sorry, it's just not clear to me.

Thank you for the awesome repo! This is one the best WP setups I've seen in terms of version control pattern/template.

Thank you.

Use mod_rewrite to block access to .git files/directories

I'm not sure if this had been considered, but it seems that .git may have a lot of information in it, that many may not wish to be publicly accessible.

I did a quick addition of a RewriteRule to redirect any request to .git to the root, but I could see arguments for having such requests be outright Forbidden, Gone, or rewritten to /index.php...

Multisite and WP Skeleton. What is the expected issues?

Hi,

when creating a multisite network with a project of mine, based on WP Skeleton, WP alerts me that subfolders based network are not completely supported, or something like that. Anyway, I did this and it's apparently working fine. The unique problem I had until now was that network-admin was not redirecting correctly. But I could fix it with this mu-plugin.

/**
 * Plugin Name: Pitou: Network Fix
 * Description: Try to provide a better experience when working with WP Network.
 */

final class Pitou_Network_Fix
{
    function __construct()
    {
        add_filter('network_admin_url', array(&$this, 'get_network_admin_url'), 10, 2);
    }

    function get_network_admin_url($url, $path)
    {
        return str_replace('wp-admin/network/', 'neferpitou/wp-admin/network/', $url);
    }
}

new Pitou_Network_Fix();

Please, notice that the code neferpitou/wp-admin/network/ is equivalent to wp/wp-admin/network/.

So, what would be the expected issues I could have in the future? I'd like to know what kind of risks existis if I deploy this project in production.

Thanks,
Thiago

Method of Updating Core & Themes

This is more of a question than a bug. With this repo setup, after deploying the site to a production server, what would be the ideal method of updating WordPress core and also the native themes that come with WordPress (e.g. - TwentyEleven)?

For the native themes, the WordPress updater appears to have issues updating due to the symlinks in the content/themes/ directory. For WordPress core would you update via the WordPress updater or by manually pointing the git submodule to a new commit SHA for the tagged release (i.e. - keeping the submodule up to date)?

Thanks for the help!

other languages?

I think that this (or something like this) need to be added to README.md:

Q: Can I use WordPress in another language?
A: No, from the box (wp directory). You can define WPLANG in 'wp-config.php' and then copy entire wp-content/languages directory in new content directory and then its works.

Problem loading theme assets

Hi I have wordpress-skeleton in a subfolder of a site eg http://site.com/site/
wp setup ran ok and site is visible in the above url BUT no styles are loaded for either the theme or plugins (same for js).

When I look at the css url it is missing the' /site/' subfolder eg

http://site.com/content/themes/mytheme/dist/styles/main.css

I have the following in wp-config.php

define('WP_SITEURL', 'http://' . $_SERVER['SERVER_NAME'] . '/site/wp');
define('WP_HOME', 'http://' . $_SERVER['SERVER_NAME'] . '/site/');

How come the theme (& plugins) asset paths are not correctly set?

Redirect loop.

Can't seem to work this one out. Here are the steps to reproduce:

  1. Clone this repo (with the --recursive flag)
  2. Create the local-config.php file, add in the db details.
  3. Visit the site.

That'll get me a redirect loop every time. Interestingly, I tried following the WordPress directory instructions, and that also resulted in a redirect loop.

Not sure if this is the correct place to post this issue, so let me know if it's a better fit for the WordPress bug tracker.

Possible SEO/canonicalization issues when setting WP_HOME constant

Hello and thanks for the great project. I'm using wp-skeleton to save on memory with opcache, and it's working quite nicely.

A marketer I work with noticed that, around the time we changed to using wp-skeleton, organic keywords dropped and Google Analytics now reports canonicalization/duplicate content issues.

Sure enough, when we tested, all the sites setup with wp-skeleton were not exhibiting the normal WP behavior of redirecting visitors to the FQDN in Settings > General > Site Address (URL). For example, even if the value was http://domain.com, WP would now would permit www.domain.com and domain.com without performing redirection.

The sites not using wp-skeleton (there are a few plugins like NGG that break with wp-skeleton, their fault and not wp-skeleton's), were behaving as expected by redirecting to the Site Address value.

The issue is corrected when we comment out the lines in wp-skeleton's custom wp-config.php that set the WP_HOME constant. Specifically, these lines:

        if ( ! defined( 'WP_HOME' ) ) {
              define('WP_HOME', 'http://' . $_SERVER['HTTP_HOST']);
        }

Once this is done, it works as expected. So it appears that by setting WP_HOME, it doesn't just disable changing of the Site Address value in settings, but it also disables the normal redirection behavior.

I've tested with these lines commented out and every other part of the site still works, whether we use www. in the setting or not, it redirects as it should and no page objects fail to load.

I wanted to report this but also ask if this is known/expected behavior, as well as if anyone see any issue with leaving out this stanza.

Thank you!

define WP_CONTENT_URL changes

Hi

Thanks for this repo, very much looking forward to using it.

While setting it up to work on a local computer, I was pleased to see the local-config.php facility and jumped in to use it. However I believe it might be better if you also allowed the following to define local paths (in local-config.php)...

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

My local paths are usually http://localhost/_mysite_ so the above line would have to include '/mysite/content' to work.

Then in the standard wp-config.php file use...

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

to test if we are on the local site or not.

In this way paths for local setups are kept in one place and we wont have to edit the main config file when its uploaded to the live site.

Any chance you can update the repo with the wp-config.php change?

Wordpress Multisite and NGINX Configuration

I'm attempting to set up WordPress skeleton in a multisite configuration. WordPress skeleton already places WordPress in a subdirectory (wp by default). I've taken the following steps:

  1. git clone WordPress-Skeleton
  2. Update Submodules and checkout 3.6.1 tag
  3. Setup local-config.php to point to my local DB
  4. Install WordPress, set site settings to example.com (site), example.com/wp (WordPress URL)
  5. Configured multisite (subdirectory) and configured NGINX to serve the Multisite properly (NGINX config can be found here: https://gist.github.com/tmort/6582961)

Once all of this is configured, I can see that the main site (example.com and example.com/wp/wp-admin) both work.

I then add a new site to the network. Upon navigating to the site url (example.com/test-network-site) the front-end is broken (style.css, for example, cannot be found at the URL http://example.com/wp/test-network-site/wp-content/themes/twentythirteen/style.css?ver=2013-07-18). When navigating to the wp-admin, I'm in a redirect loop.

My end goal is to be able to use WordPress Skeleton as a base for the sites I deploy and have the multisite configuration work as it does normally (where example.com is the network main site, example.com/test-network-site is a site within the network, and example.com/test-network-site/wp-admin works as it should). At this point my main question may be is this even possible?

Unsure of how to move forward. Any insight would be greatly appreciated!

Wrong path for template directory

I'm getting the wrong path for all assets in my themes (any theme I place into /content/themes)

For example, in the source code, a stylesheet link points to:

http://localhost/content/themes/roots/assets/css/main.min.css

when it should be:

http://localhost/lab/Wordpress-Skeleton/content/themes/roots/assets/css/main.min.css

The global $wp_theme_directories returns an array with two paths, and both are correct:

.../htdocs/lab/WordPress-Skeleton/wp/wp-content/themes .../htdocs/lab/WordPress-Skeleton/content/themes

but, the function get_theme_root_uri() when called from the functions.php of a theme located on the second path from the $wp_theme_directories array, returns:

http://localhost/content/themes

The themes from the folder /wp/wp-content/themes (the default ones that came with the WP submodule update) work fine.

fatal: reference is not a tree

When updating the submodule an error pops up:

git submodule update --init

  • branch HEAD -> FETCH_HEAD
    fatal: reference is not a tree: 0ed6b9f1fe6084e25fb78689e5c7ec9b6dbb190c
    Unable to checkout '0ed6b9f1fe6084e25fb78689e5c7ec9b6dbb190c' in submodule path 'wp'

Akismet

Since the Akismet plugin is bundled inside WordPress core, should there not be a symbolic link pointing to

./../wp/wp-content/plugins/akismet/

Same could be said for Hello Dolly, but since it doesn't add any real functional value I can see leaving it off.

Why is the additional theme directory still /wp/wp-content/themes instead of /content/themes ?

I want to use this. So I'm checking the code. One thing I can't understand is the following.

From the bulleted list in /README.md :

Custom content directory in /content/ (cleaner, and also because it can't be in /wp/)

Lines 78 - 82 in /wp-config.php :

// ===================
// Bootstrap WordPress
// ===================
if ( !defined( 'ABSPATH' ) )
    define( 'ABSPATH', dirname( __FILE__ ) . '/wp/' );

Line 3 in /content/mu-plugins/register-theme-directory.php :

register_theme_directory( ABSPATH . 'wp-content/themes/' );

Which would give a theme directory path ending in : /wp/wp-content/themes/.

RFC: Add new constant for plugins/themes to determine where WordPress resides

Certain plugins load PHP scripts directly, not through WordPress, which means that the constants are not available, yet the file then tries to load WordPress core files.

For example s2member loads a file s2member-o.php
This file tries to load wp-load.php and searches down the tree for wp-settings.php

public static function wp_dir ($starting_dir = FALSE, $alt_starting_dir = FALSE)
{
    foreach(array($starting_dir, $alt_starting_dir) as $directory)
        if($directory && is_string($directory) && is_dir($directory))
            for($i = 0, $dir = $directory; $i <= 20; $i++, $dir = dirname($dir))
                if(file_exists($dir."/wp-settings.php"))
                    return ($wp_dir = $dir);

                header ("HTTP/1.0 500 Error");
                header ("Content-Type: text/plain; charset=UTF-8");
                while (@ob_end_clean ()); // Clean any existing output buffers.
                exit ("ERROR: s2Member® unable to locate WordPress® directory.");
}

Same with the plugin image-pro, it tries to load wp-load and assumes it's path.

I don't think there is way other than patching these plugins but here's a thought:
What if we in WordPress-Skeleton create a file in the root called "wp-skeleton-define.php" this file would look something like this:

<?php
define ('WP_SKELETON', true);

Plugins and themes could check for that file, include it when it exists and then if it's set to true wp can be found in SERVER['DOCUMENT_ROOT'].'/wp' or if it's a string that would be the path.

This can only be done if we get a group supporting this, including the WordPress core developers.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.