JQuery Login Dropdown not functioning in theme

its working now:- jQuery(function() { var $button = jQuery(‘#loginButton’); var $box = jQuery(‘#site-crhead’); var $form = jQuery(‘#loginForm’); $button.live(‘click’,function(login) { console.log($box); $box.toggle(); $button.toggleClass(‘active’); }); $form.live(‘click’,function() { return false; }); jQuery(this).live(‘click’,function(login) { if(!(jQuery(login.target).parent(‘#loginButton’).length > 0)) { $button.removeClass(‘active’); $box.hide(); } }); }); Just update your code according to you, even your mouseup function was not working, according to … Read more

Delete all blogs on multisite

I was able to get a work around in place. Since I was deleting all blogs with no user interaction. I created two mysql queries and ran them. The first was to drop all tables associated with the given $blog_id the second was to remove that row from the wp_blogs table. $blogs = wp_get_sites( array(‘limit’ … Read more

Editing existing pre-created menus in PHP

I’ve found a solution to my problem by going over the documentation again and again, looking through source files and just generally running the same section of code over and over to scrutinize the output. This is the solution I came up with, which works just perfectly for my needs: // Get a list of … Read more

How to change text in a page by utilizing a custom user id?

You could use a function like so: function construction_intro( $id = ”, $echo = true ){ $id = absint( $id ); switch ($id) { case 123 : $name = “Hillary’s”; $location = “Washington D.C.”; break; case 9999 : $name = “Bernie’s”; $location = “Burlington”; break; case 47679 : $name = “Donald’s”; $location = “New York”; … Read more

How to get, in WP page’s script, a wp enqueued script (in Functions.php)?

You have to make sure your script is registered with wp_register_script before your call to wp_localize_script. So in your functions.php file: add_action(‘init’,’my demo_function’); function my demo_function() { // Register the script wp_register_script( ‘myuserscript’, ‘path/to/myscript.js’ ); // Localize the script with your data $theid=get_current_user_id(); $params = array( ‘userid’ => $theid ); wp_localize_script( ‘myuserscript’, ‘MyUserParams’, $params ); … Read more

Adding javascript to header of MetroMagazine theme

Don’t edit theme files. Your changes will be overwritten when your theme updates. Instead use a child theme and hook into the wp_head function. Add this to your child theme’s functions.php file. function add_js() { ?> <script> Your JavaScript goes here </script> <?php } add_action(‘wp_head’, ‘add_js’); BTW, as you have a commercial theme, you can … Read more

adding script tag in head of specific pages

A simple google search can help you do this, well same question was answered before, you can see the answer here. Use WordPress methods in your functions.php to do this : function load_scripts() { global $post; wp_register_script( ‘home’, get_template_directory_uri() . ‘/js/home.js’, array(‘jquery’)); wp_register_script( ‘about’, get_template_directory_uri() . ‘/js/about.js’, array(‘jquery’)); wp_register_script( ‘somepost’, get_template_directory_uri() . ‘/js/somepost.js’, array(‘jquery’)); if( … Read more

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