Wordpress theme not recognized

606 views Asked by At

In my local, it works. Here I use rocketeer to deploy the project.

In server, here is the wp-content/themes directory

./
../
foobar/
.gitignore
index.php -> /var/www/foobar.example.com/shared/wp-content/themes/index.php
twentyfifteen -> /var/www/foobar.example.com/shared/wp-content/themes/twentyfifteen/

In the admin panel, I only see twentyfifteen, but cannot see the foobar.

I'm using Nginx here

server {
    listen 80;
    server_name foobar.example.com;
    root /var/www/foobar.example.com/current;

    error_page 404 /index.php;

    location / {
        index index.php;
        try_files $uri $uri/ =404;
    }

    location ~ \.php$ {
        include fastcgi_params;
        fastcgi_index index.php;
        fastcgi_split_path_info ^(.+\.php)(/.+)$;
        fastcgi_pass unix:/var/run/php5-fpm.sock;
        fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
    }

    location ~/\.ht {
        deny all;
    }
}
2

There are 2 answers

0
Mario Sanchez Maselli On

For wordpress to recognized your themes you need to add an special header to your css something like this:

/*
Theme Name: Your Theme Name
Theme URI: http://wordpress.org/themes/twentythirteen
Author: Your Name
Author URI: http://wordpress.org/
Description: 
Version: 1.0
*/

Check this out for more info https://codex.wordpress.org/Theme_Development

0
Js Lim On

Finally I figured out the reason. I symlink all the wordpress core files

index.php
wp-activate.php
wp-admin
wp-blog-header.php
wp-comments-post.php
wp-config.php
wp-cron.php
wp-includes
wp-links-opml.php
wp-load.php
wp-login.php
wp-mail.php
wp-settings.php
wp-signup.php
wp-trackback.php
xmlrpc.php

Let's take index.php as example, the last line is

require( dirname( __FILE__ ) . '/wp-blog-header.php' );

When I actually echo it out, the dirname( __FILE__ ) is point to the shared folder.