Displaying wp menus by name without using theme locations

Umm u can do that easily. And this is the way I do how i register my menu in functions.php add_action(‘init’, ‘register_custom_menu’); function register_custom_menu() { register_nav_menu(‘custom_menu’, __(‘Custom Menu’)); } Then in ur admin panel u create different menu by ur desired name. And get the menu where ever u want like this. EX:- if I … Read more

Get background color for Live Preview with Theme Customization API?

If you’re using the built in custom background stuff, it’s already all using postMessage. So, just bind a function to the background_color message and adjust your border color accordingly. Something like this, I expect: wp.customize(‘background_color’,function( value ) { value.bind(function(to) { jQuery(‘whatever’).css(‘color’, to ? to : ” ); }); }); Obviously, change the jQuery call in … Read more

WordPress Theme customisation CSS

I’ll describe what I did on a project recently that had similar requirements. First thing I did was bundle less.php in my theme and create a function to compile a .less file in my theme into CSS and return the result. It looked like this: function wpse_283711_get_customizer_css() { $css=””; if ( file_exists( get_theme_file_path( ‘customizer.less’ ) … Read more

How to add a text widget during theme activation

You’re almost there, except each widget’s settings are stored separately from the sidebars_widgets option, which just stores widget “instances”. Try out the following function – you’ll still need to use register_sidebar, but it eases the pain for then pre-registering widgets on those sidebars. What it also does is ensure that any existing widgets & their … Read more

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