Quantcast
Channel: WordPress.org Forums » All Topics
Viewing all articles
Browse latest Browse all 59525

Load code in the header of catogery, tag, archive page

$
0
0

Replies: 0

Hi,

I’m doing some kind of optimization in which I have to load “custom CSS” code in the head of every page.

But the issue is that I have to load different CSS code for the different page. For example
_______________________
For is_front_page

<style id=”above-the-fold-css”>
Custom CSS1
</style>

____________________________
For is_archive

<style id=”above-the-fold-css”>
Custom CSS2
</style>

_________________________
For is_search

<style id=”above-the-fold-css”>
Custom CSS2
</style>

_______________

To load Custom CSS in the head of all the post, i’m using this code

add_action(‘wp_head’,’et_custom_style_for_post’);
function et_custom_style_for_post(){

$output = ”;
if(is_singular( ‘post’ )){
$output .= ‘<style id=”above-the-fold-css”>

Custom CSS
}
echo $output;
}

and adding this code in the funcation.php file

I hope you get my point. lol

——————————————————
Now, come to the point!

i need a code to load custom CSS in the head of

is_font_page
is_page
is_archive
is_Catogery
is_tag
is_search
is_single

thanks in advance


Viewing all articles
Browse latest Browse all 59525

Trending Articles