New answers tagged


One alternative approach us to have a PHP file that gets the theme options and outputs the CSS and enqueue that directly instead. eg. wp_enqueue_style('custom-css',trailingslashit(get_template_directory_uri()).'styles.php'); This may seem like a strange thing to do at first, but since actually writing a new file should be done via the WP Filesystem for ...


The only directory with guaranteed write access is the upload directory. Everything else might be protected. Nowadays, we deploy sites with Composer, keep everything under version control and create completely new sites with each deploy in order to be able to roll back the deployed site. That means that the directory will be created completely new with ...


Best place is the uploads directory - it'll be writable by the server, and it's the defacto directory for storing any user-generated/uploaded files: $dirs = wp_upload_dir(); $path = $dirs['basedir']; // /path/to/wordpress/wp-content/uploads


I think the best place to write to is to add a folder in the wp-content folder. Here you can write your css files without it is being overwritten when you have a theme update or have a WP update.


It looks like the old images are available at eg. While the site is trying to search for them at eg. There's two issues here: for some reason, your theme is requesting the images without the http:// before them; and it looks like you previously had a custom ...


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.

Top 50 recent answers are included