Theme in wp-content but my index.php search theme files in root

I assume you are adding your stylesheets like this in your header: <link rel=”stylesheet” type=”text/css” href=”https://wordpress.stackexchange.com/questions/285785/css/style.css”> Which won’t work. To construct the path dynamically, you need to use the PHP functions offered for this. Make sure your header has <?php wp_head(); ?> in it, and then enqueue your style in your theme’s functions.php file as … Read more

Pulling images from a subdomain

Managed to solve it myself.. So if anyone else has this problem. Because the sub-domain is still under the main domain you do not have to put – /home/hostname/subdomain.com you only need the /home/sub-domain.com and everything will work.. hope this helps someone.. Richard

Get the path of the first attached media (single.php)

I tried to write some snippet with the help of WordPress codex. Please check below and update it further as per your needs. I hope this helps: global $post; $args = array( ‘numberposts’ => 1, ‘order’ => ‘ASC’, ‘post_mime_type’ => ‘image’, ‘post_parent’ => $post->ID, ‘post_status’ => null, ‘post_type’ => ‘attachment’, ); $attachments = get_children( $args … Read more

Changing the server path

WordPress doesn’t rely on server path, it relies on the URI. When the WordPress code is loaded, it will define the proper paths itself dynamically by using PHP constants like __FILE__, such as ABSPATH which is the absolute path to the WordPress’s installation. So, as long as your domain remains the same, you should not … Read more

How much control do we have over CPT rewrite slugs? Can I create a “root” page for my CPT with out the page path, and then have paths for other pages?

The way I see it, you could do: // Via the init hook, do all these: register_post_type( ‘library-books’, [ ‘public’ => true, ‘label’ => ‘Library Books’, ‘rewrite’ => [ ‘with_front’ => false, ‘slug’ => ‘library/books’ ], ‘has_archive’ => ‘library/books’, // other args here ] ); register_post_type( ‘library’, [ ‘public’ => true, ‘label’ => ‘Libraries’, ‘rewrite’ … Read more

plugins_url function mixes system path and URL

Short Answer jquery-ui.widget is one of standard scripts already included and registered in WP. You don’t need to register it, just enqueue. In your code what is wrong is the dirname function inside plugin_url. Leave only __FILE__ as second argument of plugins_url Long Answer: More Info jquery-ui.widget is one of standard wordpress scripts so, in … Read more

WP Paths in a Plugin – how to include

Put this in the main plugin file (myplugin.php): defined( ‘MY_PLUGIN_URL’ ) || define( ‘MY_PLUGIN_URL’, plugin_dir_url(__FILE__) ); defined( ‘MY_PLUGIN_PATH’ ) || define( ‘MY_PLUGIN_PATH’, plugin_dir_path(__FILE__) ); right before any other code, and use MY_PLUGIN_PATH to include files, or MY_PLUGIN_URL to load your assets. E.G: require_once MY_PLUGIN_PATH . ‘templates/se.php’; wp_enqueue_style( ‘my-css’, MY_PLUGIN_URL . ‘assets/css/style.css’ ); Those constants can … Read more

Problem with loading images from child theme CSS file with relevant path

There’s no need for the wp-content/themes path – both themes sit in the same directory, so you can just traverse up one and then back down to child theme: background-image: url(../child-theme-name/images/some-image.png); Update: Regarding your answer to “where is the CSS file stored”, you inferred that the stylesheet resides in the child theme folder – in … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)