WordPress.org

Make WordPress Core

Opened 5 years ago

Last modified 3 months ago

#30105 new defect (bug)

css defining protocol

Reported by: 666threesixes666 Owned by:
Milestone: Priority: normal
Severity: normal Version: 3.8.2
Component: Themes Keywords:
Focuses: Cc:

Description

when switching between http & https css breaks. css has the protocol defined rather than using // it uses http:// or https://

to produce the problem load in apache and localhost:80, then localhost:443. one or the other will be broken.

sane:
<link rel="stylesheet" id="open-sans-css" href="//fonts.googleapis.com/css?family=Open+Sans%3A300italic%2C400italic%2C600italic%2C300%2C400%2C600&amp;subset=latin%2Clatin-ext&amp;ver=4.0" type="text/css" media="all">

insane:
<link rel="stylesheet" id="kadence_bootstrap-css" href="http://localhost/wordpress/wp-content/themes/virtue/assets/css/bootstrap.css?ver=224" type="text/css" media="all">

Change History (4)

#1 @SergeyBiryukov
5 years ago

The theme uses get_template_directory_uri(), which ultimately depends on the siteurl value.

It should work correctly with SSL if you set WordPress Address and Site Address in General Settings to SSL. (Note that relative URLs don't work there, see #21153.)

It's also possible to alter the output of the function to remove the protocol using template_directory_uri filter.

#2 follow-up: @666threesixes666
5 years ago

the problem is its not a virtue specific problem. that's extra information about my setup. the default skin, and others set the protocol. so you're telling me i can set the url to //site.com with out the protocol and it will resolve the issue? last time ive touched the url it resulted in a huge mess and having to shell to the directory and manually set the file. thanks for your prompt response, ill test //site.com

#3 in reply to: ↑ 2 @voldemortensen
5 years ago

Replying to 666threesixes666:

so you're telling me i can set the url to //site.com with out the protocol and it will resolve the issue?

He said that you cannot do that as relative urls don't work there.

"(Note that relative URLs don't work there, see #21153.)"

What he said is that get_template_diectory_uri(), the function used to fetch the url to be used, depends on your siteurl, and that changing the protocol there is possible. Either http:// or https://.

It is also possible to filter the results to remove the protocol. (You could use the template_directory filter for this.)

#4 @obenland
5 years ago

Should get_template_directory_uri() be expected to be is_ssl() agnostic?

Note: See TracTickets for help on using tickets.