Accessing site’s root from themes folder

I guess you’re talking about a site specific wp-config.php file that resides in your themes folder. At the point where you’re loading the wp-config.php file, WP isn’t fully loaded, so you ain’t got any constants or filesystem API or other basic API functions available. Here’s how I approach this: Structure # Dir structure ~/ROOT ├── … Read more

wp theme.. Could not create directory

If you can log into your host with SSH or FTP, it’s an easy fix. Like the comments said before, check your permissions for the WordPress directory. For example, if you check the hosting directory with ls -al (typically /var/www, as on DigitalOcean), they should look something like this: drwxrwxr-x 6 www-data www-data 4096 Nov … Read more

Template Hierarchy tag-{slug}.php directory

When you look at the source code, the tag template is loaded as follow in template hierarchy elseif ( is_tag() && $template = get_tag_template() ) : in wp-includes/template-loader.php get_tag_template() uses get_query_template() which uses locate_template() which loads the tag template according to hierarchy from the theme root folder So, moving your templates to a sub-folder will … Read more

Is it possible to place custom post type files inside a folder in theme directory?

You may want to look at the TwentySixteen theme, which does it this way: In single.php: get_template_part( ‘template-parts/content’, ‘single’ ); Several templates are grouped in the ‘template-parts’ folder. You could use a similar logic for your custom post type. It seems that the technique comes from _underscores.