Absolute link code in wordpress
-
Hi,
I generally work with multi-site networks and like to code my own websites from scratch and turn it into a wordpress theme.
Then they are broken up by websites (themes). All the files that I use in my project are in the theme files
For example if I build a html website from scratch I might have a file struct like below:
Folder (News)
index.html
about-us.html
contact.htmlFolder (CSS)
screen.cssFolder (JS)
main.jsThen I will convert it into a theme
Then I use ACF Pro to add CMS functionality.
I normally do this by making pages as per below:
page-home.php (Home page) then set that as the static home page. The files reside in the wp-content/themes
I understand there is a way to enqueue the style sheet and JavaScript in functions.php but this is time consuming and in my case unnecessary as I generally all my code is loaded first anyway then I’ll add the WordPress tag after it anyways.
My question is, with HTML files and websites a lot of references to links are relative for example:
<link href=”css/screen.css” rel=”stylesheet”>
WordPress doesn’t like this and will not include my styles or scripts like this unless I manually enqueue theme in the functions.php
Is there a word-press PHP function that will generate the absolute path for my link instead of manually enqueue them in the functions.php
- The topic ‘Absolute link code in wordpress’ is closed to new replies.