New answers tagged

3

You need to check if the siteurl differs from the home URL: if ( get_option( 'siteurl' ) !== get_option( 'home' ) ) { // whatever This also works if home is a subdirectory of the root, with WordPress installed in yet another subdirectory. For example: domain.com/blog (URL) and domain.com/blog/wordpress (siteurl).


0

I don't think you need a new installation to do this. You can have the WordPress files installed on the /blog/ folder and point your homepage to the site's root. Then in the settings use: WordPress Address (URL): http://mytld.com/blog/ Site Address (URL): http://mytld.com/ Make sure to read this page, specially the "Moving a Root install to its own ...


0

My recommendation is to use one WP installation and to simply add /blog/ to your permalink structure. This will give all of your blog posts a mytld.com/blog/postname format and pages will not pickup the /blog/ prefix. Adjust Permalink settings at Settings > Permalinks and select the Custom Structure radio button. Enter /blog/%postname%/ in the field and ...


1

You can read data on your server with file_get_contents(). If you want to make sure the file exists and is readable then use is_readable(). You don't really need to use trailingslashit() in this case because you're constructing the URI yourself. // path to file under current theme $json_file = get_template_directory() . ...


1

Added a check for a custom post type specific template in theme folder to @Brainternet answer. function load_person_template($template) { global $post; // Is this a "my-custom-post-type" post? if ($post->post_type == "my-custom-post-type"){ //Your plugin path $plugin_path = plugin_dir_path( __FILE__ ); // The name ...



Top 50 recent answers are included