Use wp_add_inline_style to add code to before wp_head?

Yes, that should be doable. Just enqueue your inline styles with callback hooked to wp_enqueue_scripts and priority set to 0 (assuming other styles are loader later / lower priority / bigger number). You also need to register a dummy handle to which you attach the inline styles to, so no other styles are loaded before … Read more

Media library style not loading correctly when selecting a page featured image?

After some search, the problem was in the pages which contains ACF blocks ACF plugin is not compatible with the latest WP 5.9.1 temporary fixes until the update has been released : 1- In your functions.php file add these lines: function acf_fix_preload_path( $preload_paths ) { global $post; $rest_path = rest_get_route_for_post( $post ); $remove_path = add_query_arg( … Read more

Custom CSS class or ID on menu items that have a Submenu

You could use jQuery, if you’re open to a jQuery solution? <script type=”text/javascript”> jQuery(document).ready( function($) { $(‘#your_menu_id li’).has(‘ul’).addClass(‘has_children’); }); </script> Slight modification of what i posted here basically. Any menu item with a submenu will then have a has_children class you can target in the stylesheet.. #your_menu_id li.has_children { /* your styling */ } #your_menu_id … Read more

Specific css on homepage, different one for other pages

Yes there is. You can add this to your themes header. <?php if(is_home()){ // we are on the home page echo ‘<link rel=”stylesheet” src=”https://wordpress.stackexchange.com/questions/17113/your_stylesheet” />’; } ?> You can also use other conditional tags to find out if you are on nearly every type of WordPress page. Conditional Tags Following on from the comments below, … Read more

Loading different stylesheet on WordPress pages?

Don’t use a shortcode for wp_enqueue_style(); it won’t do any good, because by the time the shortcode is parsed, all the relevant hooks ( wp_head, wp_print_styles) will have already fired. Write a function, in functions.php, to enqueue different style sheets based on is_page( $id ) (where $id can be an ID, slug, or title). Then … Read more

Include CSS with PHP without including wp-load?

EDIT Forget my answer below. You could simply use wp_register_style and wp_enqueue_style described in this answer. You could do it with an additional query variable. Add a new variable to the $query_vars array with the query_vars filter On the template_redirect action, make sure your custom.php-css file is included, if the query variable is set. // … Read more

Layer post title on top of image WordPress featured thumbnail image

the_post_thumbnail() does not return the path of your image. Instead, it returns the complete HTML markup for that image. You can use this instead: $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ) ); echo $image[0]; If you want a specific size you can pass an additional parameter: $image = wp_get_attachment_image_src( get_post_thumbnail_id( $post->ID ), ‘full’ ); echo $image[0]; … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)