I'm struggling for days with that issue was wondering if maybe some over here can help me with that ?
I'm using the http://html5blank.com/ starter theme. I have been working on my development environment without any troubles. After updating my link for migration purpose via wp-config.php with that code :
define('WP_HOME','https://pleinsens.anatoletools.com');
define('WP_SITEURL','https://pleinsens.anatoletools.com');
After updating my link my site style-sheet doesn't apply anymore and i just can't get why.
My header.php containing the following code :
<!doctype html>
<html <?php language_attributes(); ?> class="no-js">
<head>
<meta charset="<?php bloginfo('charset'); ?>">
<title><?php wp_title(''); ?><?php if(wp_title('', false)) { echo ' :'; } ?> <?php bloginfo('name'); ?></title>
<link href="//www.google-analytics.com" rel="dns-prefetch">
<link href="<?php echo get_template_directory_uri(); ?>/img/icons/favicon.ico" rel="shortcut icon">
<link href="<?php echo get_template_directory_uri(); ?>/img/icons/touch.png" rel="apple-touch-icon-precomposed">
<link href="https://fonts.googleapis.com/css?family=Barlow+Semi+Condensed:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Poppins:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css?family=Raleway:100,100i,200,200i,300,300i,400,400i,500,500i,600,600i,700,700i,800,800i,900,900i&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Crimson+Text:ital,wght#0,400;0,600;0,700;1,400;1,600;1,700&display=swap" rel="stylesheet">
<link href="https://fonts.googleapis.com/css2?family=Barlow+Condensed:ital,wght#0,100;0,200;0,300;0,400;0,500;0,600;0,700;0,800;0,900;1,100;1,200;1,300;1,400;1,500;1,600;1,700;1,800;1,900&display=swap" rel="stylesheet">
<meta http-equiv="X-UA-Compatible" content="IE=edge,chrome=1">
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="<?php bloginfo('description'); ?>">
Anyone could help me figure this out ? I'm totally losing my head with that issue !
Thanks in advance
The style.css would be being loaded by a function called wp_enque_script. We shouldn't see it in the header.php
Have you tried removing these lines?
define('WP_HOME','https://pleinsens.anatoletools.com');
define('WP_SITEURL','https://pleinsens.anatoletools.com');
The site's WP_HOME (where wordpress is located) might be different from it's WP_SITEURL (the url at which the site is accessed)
Because sub-domains are often hosted in sub-folders of their primary domain, try changing it to the following
define('WP_HOME','https://anatoletools.com/pleinsens');
define('WP_SITEURL','https://pleinsens.anatoletools.com');
Also, right click & view the source of the web-page, find the style.css that isn't loading & then double check the path/url that the link to the css file is pointing to matches what you expect it to & will load the style-sheet if pasted into your web-browser
Hope that helps! Here's a few more links that you may find helpful:
wordpress.stackexchange.com
Difference between wp_siteurl and wp_home
WP_HOME and WP_SITEURL
I tried to add icon with code
<link rel="shortcut icon" href="<?php include($_SERVER['DOCUMENT_ROOT'].'/imageslogos /favicon.ico'); ?>" />
When I look at the source code it showed lots of ? a few letters and numbers
When I clicked on this it said
The requested URL's length exceeds the capacity
limit for this server.
How do I add the icon from document root
You shouldn't use the include function since the link tag needs a reference.
Try this
<link rel="shortcut icon" href="
<?php echo $_SERVER["DOCUMENT_ROOT"]."/imageslogos/favicon.ico"; ?>
"/>
Help!!! My worst nightmare has come true. My site is broken. It happened after attempting to install some PHP scripts to automatically minify and concatenate CSS and JS files. These were MISER and Minify. Each one created problems, so I took them out. Now none of the styles are showing, despite the fact that the CSS files are referenced properly. I had backed up the site prior to making these changes, but restoring the backup does nothing to fix the problem. Does anyone have any ideas? I am in crisis mode and nothing I do seems to fix the problem!
The following code is invalid:
<link rel="stylesheet" href="/themes/C5-LR/css/foundation.css'); ?>" />
<link rel="stylesheet" href="/themes/C5-LR/typography.css'); ?>" />
<link rel="stylesheet" href="/themes/C5-LR/css/main.css'); ?>" />
'); ?> should be removed in each link.
<link href="/themes/C5-LR/css/foundation.css'); ?>" rel="stylesheet">
<link href="/themes/C5-LR/typography.css'); ?>" rel="stylesheet">
<link href="/themes/C5-LR/css/main.css'); ?>" rel="stylesheet">
All these links are broken, remove ); and you should be good just like the above answer. You only need to reference those if you are using an
#import url('some-css-file.css');
instead of
I am currently using codeigniter to write out templates for a website. The problem is that I'm trying to achieve absolute paths for attributes such as href and src, but they aren't working. I've checked my results, and the link's and scripts point through the correct directory, so I'm not sure why there is a problem.
This is the code I'm using below:
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>Home</title>
<meta name="viewport" content="width=device-width, initial-scale=1.0">
<meta name="description" content="">
<link rel="stylesheet" href="<?php echo base_url() . "assets/bootstrap/css/bootstrap.css"; ?>">
<link rel="stylesheet" href="<?php echo base_url() . "assets/bootstrap/css/bootstrap-responsive.css"; ?>">
<!-- HTML5 shim, for IE6-8 support of HTML5 elements -->
<!--[if lt IE 9]>
<script src="<?php echo base_url() . "assets/html5shiv/html5shiv.js"; ?>"></script>
<![endif]-->
<!-- Fav and touch icons go here -->
</head>
<body>
<p>This comes from the header view.</p>
<button class="btn btn-primary">Primary</button>
<br />
<a class="btn btn-primary">Secondary</a>
I can tell that this isn't working because I'm trying to use bootstrap to style two buttons, but they aren't working. Can someone please help me figure this out?
Oh, by the way..my base_url is http://localhost/ProjectName/, and I know that I have this working correctly because I have enabled the URL helper and I am able to echo the base_url.
Please make sure that You've loaded URL helper, in your autoload.php, and also make sure that you've added defined base_url in your config.php.
if not then this should help you out.
I think you haven't edited codeigniter files to enable base_url(). you try to assingn it in url_helper.php you also can do the same config/autoload.php file. you can add this code in your autoload.php
$autoload['helper'] = array('url');
There's no need to drop in and out of PHP. You can just do this:
<link rel="stylesheet" href="/assets/bootstrap/css/bootstrap.css" />
if this doesn't work there's a problem with where your css files are.
This is a bit hard to explain but I'll give it a go. Lets say I have this in the header of a HTML file called myFile.html:
<!doctype html>
<head>
<link rel="stylesheet" href="css/reset.css" />
<link rel="stylesheet" href="css/style.css" />
<script src="js/hovers.js"></script>
<link rel="stylesheet" href="css/highlight.css">
</head>
I now want to include this file in a php file, lets say index.php. However, all my assets (css, js, etc) are stored in a folder called assets/.
After including (or before?) this html file, is there a way to change all the asset paths to point to assets/*. For example, 'css/reset.css' would be changed to 'assets/css/reset.css' and so on. Note that this isn't just limited to these lines in the header, but also includes things like image elements, etc.
If that's confusing, let me know and I'll try explaining again!
Cheers :)
I usually define a constant for things like this, then it's easily changeable via a config file. It does mean going through your template files and adding this constant variable in, but after that it becomes really easy to change.
So your file would be something like this:
<?php
require_once('config.php');
include('header.php');
config.php would be something like this:
<?php
define('ASSETS_ROOT','/assets/');
and header.php would be like this:
<!doctype html>
<head>
<link rel="stylesheet" href="<?php echo ASSETS_ROOT; ?>css/reset.css" />
<link rel="stylesheet" href="<?php echo ASSETS_ROOT; ?>css/style.css" />
<script src="<?php echo ASSETS_ROOT; ?>js/hovers.js"></script>
<link rel="stylesheet" href="<?php echo ASSETS_ROOT; ?>css/highlight.css">
</head>