Pregunta

I'm editing an app on my website but the style sheet is located in this path:

home/aib23/public_html/wp-content/themes/striking_r/assets/affiliate_app_css

what would the stylesheet look like for that path? This is what I thought it was:

<link rel="stylesheet" file://home/aib23/public_html/wp-content/themes/striking_r/assets/app_css" />  

but it did not seem to work. Note that this stylesheet is placed within my wordpress theme folder.

Any help would be appreciated! Thanks in advance to those that contribute! :)

¿Fue útil?

Solución 2

This kind of path is local to the client system. So if I visit a page with this link it will look for your CSS file on my computer, at /home/aib23/public_html/wp-content/themes/striking_r/assets/app_css

Also, you need to use the href attribute in your link element in order for it to work.

I suggest you use a link relative to your web root - like this:

<link rel="stylesheet" href="/wp-content/themes/striking_r/assets/affiliate_app_css/myfile.css" />  

Replace myfile.css with the name of your stylesheet.

Otros consejos

The link to your stylesheet can be relative, but in this case you can harness WordPress's built in functions to make your life easier, like so:

<?php get_stylesheet_directory() ?>

get_stylesheet_directory() will automatically return the directory where WordPress is looking for the stylesheet. For example, if your stylesheet was named styles.css, you might use something like this:

<link rel="stylesheet" type="text/css" href="<?php get_stylesheet_directory() ?>/styles.css">

You don't need to link the complete path to the file -- WordPress will take care of that for you.

When linking to your stylesheet, you can either do it relatively or absolutely. For instance, if you're linking to a stylesheet in the same directory as your HTML document, you can simply put

<link rel="stylesheet" href="style.css" />

If, however, you want to refer to a main stylesheet throughout many HTML documents, you may want to stick with an absolute path. In your case, something like this:

<link rel="stylesheet" href="/wp-content/themes/striking_r/assets/app.css" />

Please note: Your stylesheet file name should always end with .css. Additionally, all href paths start after the public_html folder in your specific case.

Licenciado bajo: CC-BY-SA con atribución
No afiliado a StackOverflow
scroll top