wp_enqueue_script does not work

Based on your description that you “created a front-page.php and added the following” and also that there is markup in that file, you are hooking too late. You should be both registering and enqueueing on wp_enqueue_scripts but that isn’t the problem here. The problem is that by the time you try to hook, the hooks … Read more

.htaccess on multisite and roots theme?

well, I have both roots and multisite. However, I do not have roots specific rewrite rules. I have the vanilla rewrite rules defined in the docs. I use the ones for subdomains instead of subfolders. RewriteEngine On RewriteBase / RewriteRule ^index\.php$ – [L] # uploaded files RewriteRule ^files/(.+) wp-includes/ms-files.php?file=$1 [L] RewriteCond %{REQUEST_FILENAME} -f [OR] RewriteCond … Read more

Get posts in same category not working

This should work for a custom taxonomy. <?php function get_related_posts() { global $post; $taxonomy = ‘your_custom_taxonomy’; $terms = wp_get_post_terms( $post->ID, $taxonomy ); if($terms) { $term_arr=””; foreach( $terms as $term ) { $term_arr .= $term->slug . ‘,’; // create array of term slugs } $args = array( ‘showposts’ => 5, // you can change this to … Read more

No access to global variables?

To answer your question directly, yes, $wpdb is “auto loaded and set up to global by WordPress” but by loading wp-content/themes/roots/script.php directly you are skipping over the WordPress boot process and loading the file exactly as if WordPress did not exist. That is why the normal WordPress objects and constants aren’t available. They haven’t been … Read more

How to know which order WordPress places CSS files?

1. Don’t edit your theme using the WordPress editor. This is a quick-and-dirty approach to development, but you can easily destroy your entire site by mistake with this tool. Instead, edit the files on your machine locally and then use FTP to upload the changed files to the server. 2. Moving the CSS will break … Read more