Putting content into header.php without using wp_head

Removing wp_head will have some negative effects as it won’t allow you to use virtually 90% of the plugins on wordpress.org. Also some of that code you are seeing only shows up when you are logged in (unless your theme is specifically adding it). For example, the dashicons, open sans, and admin-bar stylesheets and inline … Read more

How to load different css file for different pages

You can achieve this using conditionals inside the function enqueuing your styles. function wpdocs_theme_name_scripts() { wp_enqueue_style( ‘global’, get_stylesheet_uri() ); if ( is_page(5) ) { wp_enqueue_style( ‘page-five’, get_stylesheet_uri() . ‘/page-five-styles.css’ ); } } add_action( ‘wp_enqueue_scripts’, ‘wpdocs_theme_name_scripts’ ); If you wanted more control over both the markup of your page and the CSS files you load, you … Read more

wp_head() outputs in body

This is your browser’s attempt to avoid invalid markup. Your echo ‘ test’; outputs something that does not belong in a head tag, so the browser closes it and opens the body tag. If you look at the actual unprocessed response from the server, it won’t appear this way, but that echo shouldn’t be there … Read more

How to remove pingback from head?

Here’s my improvement on it with less code for the same results: add_action( ‘plugins_loaded’, ‘wpse_158700_buffer’ ); function wpse_158700_buffer() { # Enable output buffering ob_start( ‘wpse_158700_pingback_url’ ); } function wpse_158700_pingback_url( $buffer ) { # If in the admin panel, don’t run if ( is_admin() && ( ! defined( ‘DOING_AJAX’ ) || ! DOING_AJAX ) ) { … Read more

Display custom_background outside wp_head()

custom_background() places the CSS to wp_head() as you mentioned so to get those CSS as if you don’t have wp_head() in your header, these tweaks from the core files would help: function wpse_228588_background_image_css() { $background_styles=””; if ( $bgcolor = get_background_color() ) $background_styles .= ‘background-color: #’ . $bgcolor . ‘;’; $background_image_thumb = get_background_image(); if ( $background_image_thumb … Read more

Modify page title format (when using title-tag)

If you’re using the Yoast SEO plugin (which it looks like you are) then this answer might help you If you are using yoast SEO plugin then the easiest method is to remove the archive word from “titles & metas-> Taxonomies->category” find: %%term_title%% Archives %%page%% %%sep%% %%sitename%% replace it with: %%term_title%% %%page%% %%sep%% %%sitename%% Alternatively … Read more

Add code into on a per page/post basis

As you said per page/post basis, this would work for each post add_action(‘wp_head’, ‘add_link_in_head’); function add_link_in_head() { global $post; if(!empty($post)) { $alternate = get_post_meta($post->ID, ‘alternate’, true); $hreflang = get_post_meta($post->ID, ‘hreflang’, true); if(!empty($alternate) && !empty($hreflang)) { ?> <link rel=”alternate” href=”https://wordpress.stackexchange.com/questions/110260/<?php echo $alternate; ?>” hreflang=”<?php echo $hreflang; ?>” /> <?php } } } If there is no … Read more

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