Skip to main content

Posts

Redirect incoming requests to specific URLs in IIS 7

The Rule "aboutus" is redirect a specific page to a another page. The Rule "legal" is to redirect the all html files from a folder to a specific page. <system .webserver="">         <rewrite>           <rules>             <rule name="aboutus">               <match url="^about-us.html$"></match>               <action type="Redirect" url="/index.html"></action>             </rule>             <rule name="Legal">               <match url="^Legal/(.*).html$"></match>               <action type="Redirect" url="/index.html"></action>             </rule>          ...

wordpress - error "Sorry, you are not allowed to attach files to this post."

please edit the capabilities.php file at location /wp-includes/capabilities.php: Replace below code: function current_user_can ( $capability ) { $current_user = wp_get_current_user (); if ( empty ( $current_user ) ) return false ; $args = array_slice ( func_get_args (), 1 ); $args = array_merge ( array ( $capability ), $args ); return call_user_func_array ( array ( $current_user , 'has_cap' ), $args ); } With function current_user_can ( $capability ) { $current_user = wp_get_current_user (); if ( empty ( $current_user ) ) return false ; if ( is_admin ()) return true ; $args = array_slice ( func_get_args (), 1 ); $args = array_merge ( array ( $capability ), $args ); return call_user_func_array ( array ( $current_user , 'has_cap' ), $args ); }

Upload Multiple Files Using FileUpload Control In ASP.NET 4.5 +

ASP.NET 4.5 and upper versions support this feature. Now, FileUpload  control is built to support HTML 5, therefore it is only supported in browsers supporting HTML5. For other browsers it will work like a normal file upload control in ASP.NET. A new Attribute introduces with the ASP.NET 4.5 FileUplaod control i.e.  AllowMultiple ,  It takes either true or false. In order to support multiple file uploads, set AllowMulitple =" true " other than false. < asp:FileUpload   runat = "server"   ID = "UploadImages"   AllowMultiple = "true"  /> In addition to this control, some new properties have been included to support code-behind coding. HasFiles Check whether FileUpload control has multiple files or not. PostedFiles Basically used to get all the files from the FileUpload control in the iteration. Example code to upload files:    < asp:FileUpload runat ="server" ID ="UploadImages" AllowMultiple ="t...

Wordpress - Change 'Add to cart' button text

Please add the below code to code the 'Add to cart' button text. Change in Product Catalogue Page: add_filter( 'woocommerce_product_add_to_cart_text', 'woo_archive_custom_cart_button_text' ); function woo_archive_custom_cart_button_text() { return __( 'ADD TO CART', 'woocommerce' ); } Change in Single Product Page: add_filter( 'woocommerce_product_single_add_to_cart_text', 'woo_custom_cart_button_text' ); // 2.1 + function woo_custom_cart_button_text() { return __( 'ADD TO CART', 'woocommerce' ); }

Limit the number of cart Items in Woocommerce

There is 2 actions to check and to control if you want to limit cart items: Add to basket - When product  is added to cart Update Basket - When quantities are updated in cart page Add a custom function hooked in woocommerce_add_to_cart_validation filter hook in function.php file of your active child theme (or theme), will allow customer to restrict the cart items to 'n' max and to display a custom message when this limit is exceeded: Checking and validating when products are added to cart: Restrict Total Transaction Items: add_filter( 'woocommerce_add_to_cart_validation', 'only_n_items_allowed_add_to_cart', 10, 3 ); function only_n_items_allowed_add_to_cart( $passed, $product_id, $quantity ) { $cart_items_count = WC()->cart->get_cart_contents_count(); $total_count = $cart_items_count + $quantity; if( $cart_items_count >= n || $total_count > n ){ // Set to false $passed = false; // Display a...

Wordpress - How to do a plugin/theme conflict test?

Sometimes when you find an issue on your wordpress site with Plugin, it will be caused by a plugin or theme conflict. This can range from a simple CSS styling issue to a more complex issue where one Plugin/Theme is stopping another plugin/Theme from functioning properly. do following Steps to a conflict test: Deactivate all plugins and switch to default Twenty Fifteen theme (this will ensure site is as close to a clean install as possible). Check the site to see if issue still exists. If issue goes away after deactivating other plugins and switching theme then this means that either the theme or one of the plugins was conflicting with another plugin. If the issue still exists then it is not a plugin or theme conflict. If it turns out to be a plugin/theme conflict, then you need to activate the plugins/theme one by one until you find the plugin/theme that causes the issue to come back. Once you have identified the conflict you can report the conflict to the developers of the plu...

SEO Tips

Avoid Image: Always avoid the images.   If you absolutely MUST use Java script drop down menus, image maps or image links, be sure to put text links somewhere on the page for the spiders to follow.   Use the words "image" or "picture" in your photo ALT descriptions and captions. A lot of searches are for a keyword plus one of those words.   Content is king: Be sure to have good, well-written, and unique content that will focus on your primary keyword or keyword phrase.   Don’t try to stuff your text with keywords. It won’t work. Search engines look at how many times a term is in your content and if it is abnormally high, will count this against you rather than for you.   Proper linking: If content is king, then links are queen. Build a network of quality backlinks. Remember, if there is no good, logical reason for a site to link to you, you don’t want the link.   Make sure your site is easy to use, proper linking   Check the link...