Discussion:
Theme Development: load stylesheet with wp_enqueue_style
Guido WP
2013-09-21 07:50:07 UTC
Permalink
Hi all,

I'm developing my first (simple) WP Theme and I want to load the main stylesheet with wp_enqueue_style in functions.php.

function my_scripts() {
wp_enqueue_style( 'main-style', get_template_directory_uri() . '/style.css', false, '1.0', 'all' );
}
add_action( 'wp_enqueue_scripts', 'my_scripts' );

I tried also get_stylesheet_uri() or get_stylesheet_directory_uri() . '/style.css' instead of get_template_directory_uri.

If I load the stylesheet in the header.php by using a link tag everything is fine.
The file is there, the get_template_directory_uri() function points to the right place - I tested it out by using echo command in frontpage.php

I checked the apache logs, and the wp-logs - there are no error messages.

I don't no where to start further analysis ?

If I use another theme (e.g. twenty thirteen) the functions works - it's the same way the stylesheet is loaded.
That means to me the system is o.k. - there must be something wrong with my theme.

Are there any tools to analyze the execution process at the php site or set some breakpoints or create some log entries?

Thank you very much for a hint or advise.

Regards, Guido
Daniel
2013-09-21 07:56:14 UTC
Permalink
Does turning on wp_debug bring up anything? What the source code look
like when view your site? Is the style tag showing?
Post by Guido WP
Hi all,
I'm developing my first (simple) WP Theme and I want to load the main
stylesheet with wp_enqueue_style in functions.php.
function my_scripts() {
wp_enqueue_style( 'main-style', get_template_directory_uri() .
'/style.css', false, '1.0', 'all' );
}
add_action( 'wp_enqueue_scripts', 'my_scripts' );
I tried also get_stylesheet_uri() or get_stylesheet_directory_uri() .
'/style.css' instead of get_template_directory_uri.
If I load the stylesheet in the header.php by using a link tag everything is fine.
The file is there, the get_template_directory_uri() function points to the
right place - I tested it out by using echo command in frontpage.php
I checked the apache logs, and the wp-logs - there are no error messages.
I don't no where to start further analysis ?
If I use another theme (e.g. twenty thirteen) the functions works - it's the
same way the stylesheet is loaded.
That means to me the system is o.k. - there must be something wrong with my theme.
Are there any tools to analyze the execution process at the php site or set
some breakpoints or create some log entries?
Thank you very much for a hint or advise.
Regards, Guido
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
--
Regards,
Daniel Fenn
Guido WP
2013-09-21 08:02:08 UTC
Permalink
thanks - wp_debug is on - nothing to see
the style tag isn't shown in source code - so that means to me that the function within php is not executing correctly.
anyway if I build in an error (missing ; for example) php recognize that and bring up an error message - so I understand that the functions.php is loading.
Is there anything I have to have within my directory structure so that wp_enqueue_style or wp_enqueue_script is working correctly?
Post by Daniel
Does turning on wp_debug bring up anything? What the source code look
like when view your site? Is the style tag showing?
Post by Guido WP
Hi all,
I'm developing my first (simple) WP Theme and I want to load the main
stylesheet with wp_enqueue_style in functions.php.
function my_scripts() {
wp_enqueue_style( 'main-style', get_template_directory_uri() .
'/style.css', false, '1.0', 'all' );
}
add_action( 'wp_enqueue_scripts', 'my_scripts' );
I tried also get_stylesheet_uri() or get_stylesheet_directory_uri() .
'/style.css' instead of get_template_directory_uri.
If I load the stylesheet in the header.php by using a link tag everything is fine.
The file is there, the get_template_directory_uri() function points to the
right place - I tested it out by using echo command in frontpage.php
I checked the apache logs, and the wp-logs - there are no error messages.
I don't no where to start further analysis ?
If I use another theme (e.g. twenty thirteen) the functions works - it's the
same way the stylesheet is loaded.
That means to me the system is o.k. - there must be something wrong with my theme.
Are there any tools to analyze the execution process at the php site or set
some breakpoints or create some log entries?
Thank you very much for a hint or advise.
Regards, Guido
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
--
Regards,
Daniel Fenn
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Roger Chen
2013-09-21 08:10:49 UTC
Permalink
Make sure you have a call to wp_head() in your header first.

Roger
Post by Guido WP
thanks - wp_debug is on - nothing to see
the style tag isn't shown in source code - so that means to me that the
function within php is not executing correctly.
anyway if I build in an error (missing ; for example) php recognize that
and bring up an error message - so I understand that the functions.php is
loading.
Is there anything I have to have within my directory structure so that
wp_enqueue_style or wp_enqueue_script is working correctly?
Post by Daniel
Does turning on wp_debug bring up anything? What the source code look
like when view your site? Is the style tag showing?
Post by Guido WP
Hi all,
I'm developing my first (simple) WP Theme and I want to load the main
stylesheet with wp_enqueue_style in functions.php.
function my_scripts() {
wp_enqueue_style( 'main-style', get_template_directory_uri() .
'/style.css', false, '1.0', 'all' );
}
add_action( 'wp_enqueue_scripts', 'my_scripts' );
I tried also get_stylesheet_uri() or get_stylesheet_directory_uri() .
'/style.css' instead of get_template_directory_uri.
If I load the stylesheet in the header.php by using a link tag
everything is
Post by Daniel
Post by Guido WP
fine.
The file is there, the get_template_directory_uri() function points to
the
Post by Daniel
Post by Guido WP
right place - I tested it out by using echo command in frontpage.php
I checked the apache logs, and the wp-logs - there are no error
messages.
Post by Daniel
Post by Guido WP
I don't no where to start further analysis ?
If I use another theme (e.g. twenty thirteen) the functions works -
it's the
Post by Daniel
Post by Guido WP
same way the stylesheet is loaded.
That means to me the system is o.k. - there must be something wrong
with my
Post by Daniel
Post by Guido WP
theme.
Are there any tools to analyze the execution process at the php site or
set
Post by Daniel
Post by Guido WP
some breakpoints or create some log entries?
Thank you very much for a hint or advise.
Regards, Guido
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
--
Regards,
Daniel Fenn
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Guido WP
2013-09-21 08:14:44 UTC
Permalink
ups - thank you Roger, you saved my weekend.
Post by Roger Chen
Make sure you have a call to wp_head() in your header first.
Roger
Post by Guido WP
thanks - wp_debug is on - nothing to see
the style tag isn't shown in source code - so that means to me that the
function within php is not executing correctly.
anyway if I build in an error (missing ; for example) php recognize that
and bring up an error message - so I understand that the functions.php is
loading.
Is there anything I have to have within my directory structure so that
wp_enqueue_style or wp_enqueue_script is working correctly?
Post by Daniel
Does turning on wp_debug bring up anything? What the source code look
like when view your site? Is the style tag showing?
Post by Guido WP
Hi all,
I'm developing my first (simple) WP Theme and I want to load the main
stylesheet with wp_enqueue_style in functions.php.
function my_scripts() {
wp_enqueue_style( 'main-style', get_template_directory_uri() .
'/style.css', false, '1.0', 'all' );
}
add_action( 'wp_enqueue_scripts', 'my_scripts' );
I tried also get_stylesheet_uri() or get_stylesheet_directory_uri() .
'/style.css' instead of get_template_directory_uri.
If I load the stylesheet in the header.php by using a link tag
everything is
Post by Daniel
Post by Guido WP
fine.
The file is there, the get_template_directory_uri() function points to
the
Post by Daniel
Post by Guido WP
right place - I tested it out by using echo command in frontpage.php
I checked the apache logs, and the wp-logs - there are no error
messages.
Post by Daniel
Post by Guido WP
I don't no where to start further analysis ?
If I use another theme (e.g. twenty thirteen) the functions works -
it's the
Post by Daniel
Post by Guido WP
same way the stylesheet is loaded.
That means to me the system is o.k. - there must be something wrong
with my
Post by Daniel
Post by Guido WP
theme.
Are there any tools to analyze the execution process at the php site or
set
Post by Daniel
Post by Guido WP
some breakpoints or create some log entries?
Thank you very much for a hint or advise.
Regards, Guido
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
--
Regards,
Daniel Fenn
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Justin Tadlock
2013-09-21 16:26:57 UTC
Permalink
Also, make sure you use |get_stylesheet_uri()| (reference
<http://codex.wordpress.org/Function_Reference/get_stylesheet_uri>) to
load a theme's |style.css|. Otherwise, some plugins might not work
correctly.
Post by Guido WP
ups - thank you Roger, you saved my weekend.
Post by Roger Chen
Make sure you have a call to wp_head() in your header first.
Roger
Post by Guido WP
thanks - wp_debug is on - nothing to see
the style tag isn't shown in source code - so that means to me that the
function within php is not executing correctly.
anyway if I build in an error (missing ; for example) php recognize that
and bring up an error message - so I understand that the functions.php is
loading.
Is there anything I have to have within my directory structure so that
wp_enqueue_style or wp_enqueue_script is working correctly?
Post by Daniel
Does turning on wp_debug bring up anything? What the source code look
like when view your site? Is the style tag showing?
Post by Guido WP
Hi all,
I'm developing my first (simple) WP Theme and I want to load the main
stylesheet with wp_enqueue_style in functions.php.
function my_scripts() {
wp_enqueue_style( 'main-style', get_template_directory_uri() .
'/style.css', false, '1.0', 'all' );
}
add_action( 'wp_enqueue_scripts', 'my_scripts' );
I tried also get_stylesheet_uri() or get_stylesheet_directory_uri() .
'/style.css' instead of get_template_directory_uri.
If I load the stylesheet in the header.php by using a link tag
everything is
Post by Daniel
Post by Guido WP
fine.
The file is there, the get_template_directory_uri() function points to
the
Post by Daniel
Post by Guido WP
right place - I tested it out by using echo command in frontpage.php
I checked the apache logs, and the wp-logs - there are no error
messages.
Post by Daniel
Post by Guido WP
I don't no where to start further analysis ?
If I use another theme (e.g. twenty thirteen) the functions works -
it's the
Post by Daniel
Post by Guido WP
same way the stylesheet is loaded.
That means to me the system is o.k. - there must be something wrong
with my
Post by Daniel
Post by Guido WP
theme.
Are there any tools to analyze the execution process at the php site or
set
Post by Daniel
Post by Guido WP
some breakpoints or create some log entries?
Thank you very much for a hint or advise.
Regards, Guido
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
--
Regards,
Daniel Fenn
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
_______________________________________________
wp-hackers mailing list
http://lists.automattic.com/mailman/listinfo/wp-hackers
Loading...