Proper after_setup_theme and wp_head cleanup

What you should do: Read Where to put my code: plugin or functions.php? and apply the lessons to your theme. Themes are for presentation only. Remove everything not related to presentation: do not touch link and meta elements in the header. That’s plugin territory. Remove redundant code. add_theme_support(‘menus’); is not necessary, if you call register_nav_menus(). … Read more

How can I add Javascript in the header of all post pages and only post pages

Check the type of the queried object on the page and the post type: function function_that_returns_js_string() { $obj = get_queried_object(); $type = is_a($obj,’WP_Post’); if (true === $type && ‘post’ == $obj->post_type) { echo ‘your string’; } } add_action(‘wp_head’, ‘function_that_returns_js_string’); However, I am concerned that you are inserting a script directly into the head of the … Read more

What is the safe way to print tracking code / pixel code before tag or tag

It sounds like you’re trying to implement a general purpose field for users to enter any kind of tracking code/JS into. This approach gives users the most flexibility but it means that you are trusting them to put whatever JavaScript that they want into the header and footer. By default, users need the administrator or … Read more

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