Full-width-height-of-viewport

// global vars var winWidth = $(window).width(); var winHeight = $(window).height(); // set initial div height / width $(‘div’).css({ ‘width’: winWidth, ‘height’: winHeight, }); // make sure div stays full width/height on resize $(window).resize(function(){ $(‘div’).css({ ‘width’: winWidth, ‘height’: winHeight, }); }); Source: https://coderwall.com/p/nsv3cq/div-full-width-height-of-viewport

Plugin API/Filter Reference/login redirect « WordPress Codex

/** * Redirect user after successful login. * * @param string $redirect_to URL to redirect to. * @param string $request URL the user is coming from. * @param object $user Logged user’s data. * @return string */function my_login_redirect( $redirect_to, $request, $user ) { //is there a user to check? if ( isset( $user->roles ) &&…

WP Snippet: Block access to the mainsite dashboard in WordPress multisite – WPcustoms Codes

if you are running a WordPress Multisite and want to restrict the access to the dashboard of the main site to everyone apart from the super admin use this snippet Source: WP Snippet: Block access to the mainsite dashboard in WordPress multisite – WPcustoms Codes     add_filter(‘body_class’,’browser_body_class’); function browser_body_class($classes) { global $is_lynx, $is_gecko, $is_IE,…

Form Submit button

https://www.tjvantoll.com/2013/01/01/enter-should-submit-forms-stop-messing-with-that/   Therefore, if you have a form with more than one input field, always include a submit button. Specifically an <input> with the type=”submit” attribute, or a <button> element should be present. (Note: IE7 has a bug where the typeattribute of a <button> defaults to button instead of submit. Therefore for IE7 compatibility you’ll need <button type=”submit”>.)

php – Preserve Line Breaks – Simple HTML DOM Parser – Stack Overflow

realized there was actually a built in option to turn off the removal of line breaks. No need to go editing the source.The PHP Simple HTML Dom Parser’s load function supports multiple useful parameters:load($str, $lowercase=true, $stripRN=false, $defaultBRText=DEFAULT_BR_TEXT)When calling the load function, simply pass false as the third parameter.$html = new simple_html_dom();$html->load(“stuff”, true, false);If using file_get_html,…

using jquery serialize in ajax operation for plugin

1 Answer activeoldestvotes up vote0down voteaccepted Provided that your server receives data in the form of a string which it should if you’re using the jQuery serialize() function. It will be something like: name1=value&name2=value&name3=value You just need to parse the string into an array as follows: $parameters = array(); parse_str($_GET, $parameters); See the following for…