Why would wp_head() cause the menus to break?

wp_head() and wp_footer() are absolute requirements for any WordPress theme. Without them, themes, plugins, and WordPress core can’t enqueue scripts and styles that are crucial for the correct functioning of your site. (So if something has to go, it’s the menu plugin and not wp_head()). Unfortunately, a lot of plugins don’t actually implement their styles … Read more

Set up description meta automatically

You can use first few lines of post content and add these to meta description tags to website head section automatically. Here is how you do that. // add meta description tag function wcs_add_meta_description_tag() { global $post; if ( is_single() ) { $meta = strip_tags( $post->post_content ); $meta = strip_shortcodes( $post->post_content ); $meta = str_replace( … Read more

Set title of page using custom page template

For dog breeds, I added the following code to template pages, overwriting the WP SEO functions: function assignPageTitle() { // To set page title global $resultarray; return $resultarray->breed_title; } if ( uri_segment( 2 ) != ‘0’ ) { add_filter( ‘wpseo_title’, ‘assignPageTitle’ ); // WP SEO function overwritten } For a list of other WP SEO … Read more

using wp_head in body tag for css style

It’s not working because you’re calling add_action after the actual action is fired. If you move the action declaration before wp_head() it will work: <html> <head> <?php add_action( ‘wp_head’, function () { echo ‘<style type=”text/css”>.sc_title {color:#fff; font-weight:600;}</style>’; }); ?> <?php wp_head(); ?> There’s no easy way to add some code to the head from the … Read more

Change default s.w.org dns-prefetch resource hint value

var_export( $hints ); gave me array ( 0 => ‘https://s.w.org/images/core/emoji/2.4/svg/’, ) so that means the array key is not s.w.org but https://s.w.org/images/core/emoji/2.4/svg/. Changing the function and using the key of the array with the full url did remove the s.w.org hint while still letting me use resource hints. function resource_hints( $hints, $relation_type ) { if … Read more

removing wordpress generated code from the head section?

1) Normally not (that’s the translation mechanism offered for javscript strings), but you can probably de-register that l10n script. But be warned that some plugins and the site might not work as intended any longer. 2) Yes, by uninstalling the contact form 7 plugin. 3) Yes, by removing the disqus plugin. 4) If disabling the … Read more

Removing Visual Composer head meta (works alone but not with IF)

your problem boils down to doing things before the init hook was fired. You should never check for code existence, DB structure before it. In case of frontend related code you should not do anything before template_redirect hook. Your code should be like add_action(‘wp_head’, ‘myoverride’, 1); function myoverride() { if ( class_exists( ‘Vc_Manager’ ) ) … Read more

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