Multiple domains for multiple single installs

Serve both sites from the same installation. In your wp-config.php include the settings depending on $_SERVER[‘HTTP_HOST’]. Example for a complete wp-config.php: define( ‘DB_HOST’, ‘localhost’ ); define( ‘DB_CHARSET’, ‘utf8’ ); define( ‘DB_COLLATE’, ‘utf8_general_ci’ ); if ( ‘example.net’ === $_SERVER[‘HTTP_HOST’] ) // .net domain include ‘example.net.config.php’; elseif ( ‘example.com’ === $_SERVER[‘HTTP_HOST’] ) // .com domain include ‘example.com.config.php’; … Read more

Can I put my WordPress theme files in another folder?

The answer is yes. Like @Kvvaradha mentioned in his comments. If you put header.php footer.php index.php functions.php style.css must be in /wp-content/themes/your-theme-folder. And other your library, components and includes could be put anywhere that you prefer. But, make sure files and folders structure are flexible. Good luck in your codes 🙂

Custom Post Type Archive in Sub Folder

Unlike page templates, WordPress doesn’t look in subdirectories for post template pages. The base function used for locating such templates is locate_template() (see source), which looks in the root directory of your theme (and parent theme). (On the other hand get_page_templates() searches sub-directory). You can use template_include filter (which filters the absolute path to your … Read more

How do I serve static content on same domain as WordPress

If the files are static HTML, then you only need to be concerned with name collisions for the directory structure. And if you don’t have anything in WordPress that generates /demo/subfolder/ you don’t have to worry about ignoring it – it’s already ignored. I have a sandbox folder that I use for a similar purpose … Read more

Change upload directory for PDF files

Following Justice Is Cheap lead, I ended adapting the functions from this plugin: http://wordpress.org/extend/plugins/custom-upload-dir/ <?php /* * Change upload directory for PDF files * Only works in WordPress 3.3+ */ add_filter(‘wp_handle_upload_prefilter’, ‘wpse47415_pre_upload’); add_filter(‘wp_handle_upload’, ‘wpse47415_post_upload’); function wpse47415_pre_upload($file){ add_filter(‘upload_dir’, ‘wpse47415_custom_upload_dir’); return $file; } function wpse47415_post_upload($fileinfo){ remove_filter(‘upload_dir’, ‘wpse47415_custom_upload_dir’); return $fileinfo; } function wpse47415_custom_upload_dir($path){ $extension = substr(strrchr($_POST[‘name’],’.’),1); if(!empty($path[‘error’]) || … Read more

get_template_directory() vs bloginfo( ‘template_directory’ ) vs TEMPLATEPATH

To make a long story short: get_bloginfo( ‘template_directory’ ) and get_bloginfo( ‘template_url’ ) simply return get_template_directory_uri(). So, you can shortcut that second call simply by referring directly to the latter template tag. Refer to source for get_bloginfo(). A few others: ‘url’ => home_url() ‘wpurl’ => site_url() ‘stylesheet_url’ => get_stylesheet_uri() ‘stylesheet_directory’ => get_stylesheet_directory_uri() ‘locale’ => get_locale() … Read more

Listing only directories using ls in Bash?

*/ is a pattern that matches all of the subdirectories in the current directory (* would match all files and subdirectories; the / restricts it to directories). Similarly, to list all subdirectories under /home/alice/Documents, use ls -d /home/alice/Documents/*/