How to concatenate inside the _e() function the right way?

the_search_query() echoes itself, so by putting it into another echo function (what _e() is) you’ll get result as in second example. It isn’t recommended to use variables or function inside l18n functions, because they can’t be translated, for more information see Otto’s: Internationalization: You’re probably doing it wrong. So you should use code like this: … Read more

Editing the custom background CSS

Yes, that is possible. Take a look at the codex and you will see that you can pass arguments with add_theme_support( ‘custom-background’). One of them is the callback function that generates the <style> tags: _custom_background_cb. You can pass your own function as an argument to add_theme_support. Here is the code of the original function (retrieved … Read more

The difference between calling wp_enqueue_scripts to load scripts and styles in custom theme

wp_enqueue_scripts Action Hook: WordPress provides various names (or place holders) that can be used to inject callback functions within WordPress core’s execution lifecycle. These are called action and filter hooks. wp_enqueue_scripts is a WordPress action hook. Note: It’s not wp_enqueue_script, it’s plural: wp_enqueue_scripts. With this hook, we add script or style on the correct time … Read more

How do I check if a menu exists?

Assuming that you have custom Nav Menus implemented properly: Registering nav menu Theme Locations: register_nav_menus( array( ‘parent_page’ => “Parent Page”, ‘page_a’ => “Page A”, ‘page_b’ => “Page B”, //etc ) ); Calling wp_nav_menu() correctly: wp_nav_menu( array( ‘theme_location’ => ‘page_a’ ); …then you can use the has_nav_menu() conditional to determine if a Theme Location has a … Read more

enqueue script for specific shortcode

wp_enqueue_script is not going to work in a shortcode, this is because of the loading order. You could use wp_register_script and then you could wp_enqueue_script in you shortcode function like this example: // Front-end function front_end_scripts() { wp_register_script( ‘example-js’, ‘//example.com/shared-web/js/example.js’, array(), null, true ); } add_action( ‘wp_enqueue_scripts’, ‘front_end_scripts’ ); Then you use this in your … Read more

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