I`m using this code in functions.php:
add_action('wp_head', 'addMyStyle');
function addMyStyle() {
wp_enqueue_style( 'bootstrap', get_template_directory_uri() . '/css/bootstrap.css', false, '1.0', 'all', false );
wp_enqueue_style( 'bootstrap-rtl', get_template_directory_uri() . '/css/bootstrap-rtl.css', false, '1.0', 'all', false );
wp_enqueue_style( 'style', get_template_directory_uri() . '/style.css', false, '1.0', 'all' );
}
and <?php wp_head(); ?>
tag is right before </head>
tag. but style files load in footer tags. I want these styles load in head tags.
Inside my <head>
tags:
<!DOCTYPE html>
<html xmlns="http://www.w3.org/1999/xhtml" dir="rtl" xml:lang="fa" lang="fa">
<?php global $current_user; get_currentuserinfo(); ?>
<head>
<meta name="theme-color" content="#1B5064" />
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
<meta name="viewport" content="width=device-width, initial-scale=1" />
<meta name="HandheldFriendly" content="True">
<link rel="shortcut icon" href="/favicon-16x16.png" />
<!-- Global site tag (gtag.js) - Google Analytics -->
<script async src="https://www.googletagmanager.com/gtag/js?id=UA--1"></script>
<script>
window.dataLayer = window.dataLayer || [];
function gtag(){dataLayer.push(arguments);}
gtag('js', new Date());
gtag('config', 'UA--1');
function resizeIframe(obj) {
obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
obj.style.height = 0;
obj.style.height = obj.contentWindow.document.body.scrollHeight + 'px';
}
</script>
<meta name="google-site-verification" content="" />
<?php
if ( wp_is_mobile() ) {
?>
<style>.woocommerce-cart-form .container {overflow:scroll;}</style>
<?php
}
?>
<?php wp_head(); ?>
</head>
wp_enqueue_style
. You have 6 and the function only takes 5: developer.wordpress.org/reference/functions/wp_enqueue_style