[wp-hackers] Theme Development: load stylesheet with wp_enqueue_style

Justin Tadlock justin at justintadlock.com
Sat Sep 21 16:26:57 UTC 2013


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.

On 9/21/2013 3:14 AM, Guido WP wrote:

> ups - thank you Roger, you saved my weekend.
>
> Am 21.09.2013 um 10:10 schrieb Roger Chen <developer at rogerhub.com>:
>
>> Make sure you have a call to wp_head() in your header first.
>>
>> Roger
>>
>>
>> On Sat, Sep 21, 2013 at 1:02 AM, Guido WP <guido at wp-butler.com> wrote:
>>
>>> 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?
>>>
>>>
>>> Am 21.09.2013 um 09:56 schrieb Daniel <danielx386 at gmail.com>:
>>>
>>>> Does turning on wp_debug bring up anything? What the source code look
>>>> like when view your site? Is the style tag showing?
>>>>
>>>> On 9/21/13, Guido WP <guido at wp-butler.com> wrote:
>>>>> 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
>>>>> wp-hackers at lists.automattic.com
>>>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>>>
>>>> --
>>>> Regards,
>>>> Daniel Fenn
>>>> _______________________________________________
>>>> wp-hackers mailing list
>>>> wp-hackers at lists.automattic.com
>>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>> _______________________________________________
>>> wp-hackers mailing list
>>> wp-hackers at lists.automattic.com
>>> http://lists.automattic.com/mailman/listinfo/wp-hackers
>>>
>> _______________________________________________
>> wp-hackers mailing list
>> wp-hackers at lists.automattic.com
>> http://lists.automattic.com/mailman/listinfo/wp-hackers
> _______________________________________________
> wp-hackers mailing list
> wp-hackers at lists.automattic.com
> http://lists.automattic.com/mailman/listinfo/wp-hackers
>


More information about the wp-hackers mailing list