How to Protect Integrity of Responsive WordPress Theme?

WordPress has become the most favored open-source content management system, because of several reasons including ease-of-use, availability of copious themes and plugins and much more. In fact, WordPress offers many tools, resources, etc. for building a great responsive website. However, your WP responsive theme is liable to break, if you hand off your theme to a user admin with informed ignorance. So it is important to protect Integrity of Responsive WordPress Theme.

 

We have shared why actions (responsive websites) scream louder than words in the earlier post. You can check here,  Responsive Web Designing Guide.

 

Simply put, assigning your RWD (responsive web design) work to your site admin with no knowledge or little knowledge of RWD or integrating a theme in WordPress, makes your site susceptible to damage. So, if you’ve started racking your brains on how to protect your WP site from getting, there are a few RWD rules following which you can protect your responsive site from getting damaged in the hands of your user admins.

 

Protect Integrity of Responsive WordPress Theme

 

Major 3 RWD Rules to Protect Integrity of Responsive WordPress Theme:

 

However, in this post I’ll be talking about the major 3 RWD rules to Protect Integrity of Responsive WordPress Theme. You must keep it in your mind prior to assigning your responsive WordPress website to your user admin. (Following these rules will help you take control back over media elements).

 

Media

 

WP core developers have put in efforts and made it extremely easy to upload, insert and modify media elements. However, there still exists one main issue that is including static width and height attributes. When your WP user admin uploads an image in the “Media” and inserts it into some content, or a post, the HTML code will look like the below-given code:

 

<ahref=”http://test.com/getinspired/do-what-makes-you-awesome”><imgsrc=”http://test.com/wp-content/uploads/2013/03/20130324-220448.jpg” alt=”Do what makes you awesome” width=”400″ height=”527″ class=”alignnone size-full wp-image-249″ /></a>

 

Looking at the above code you’ll see that the <img> tag includes static width and height attributes. However, the problem is that attribute values in HTML are based on the image’s actual size – so in case a user admin selects ‘full size’ the added image will stretch to thousands of pixels wide. So, to compensate for the errors that might pop up and make users’ content explode out of the containing area, follow the below-listed steps:

 

  • Make the user admin well-verse with media uploading. Educate them that it’s NOT necessary to include full-size images every time. Once they understand your point, make them understand about how to remove the attributes using the HTML view in the editor.
  • The second step requires putting a CSS max-width class on all images, and other media in the code.

 

CSS

.post img { max-width: 100%; }

 

Just embedding the above one line of CSS will evade the image or media from getting out of the containing element and it will help to Protect Integrity of Responsive WordPress Theme.

 

Navigation Menus

 

Navigation is the most important element of every site. If your navigation is not accurate you’ll end up having a website that can’t be moved around easily. User admins can tweak the navigations, but to make them go wrong there are several things that you can opt for.

 

For instance, you can use custom walkers that gives you the control over the output markup of the entire menu on your theme. Besides this, try to test adding menu items to your theme. You can begin with  adding a simple menu, to exceeding the count of menu items to 10 nav items, and more. After this add drop-downs, followed by more drop-downs. You can even set the ‘depth’ parameter on the wp_nav_menu() so as to prevent the glut of drop-downs.

 

Featured images

 

For every responsive site ‘Featured images’ are apparently the most effective tool for web designers. Now, when a user admin uploads image and set as the featured image via the content editor, they can do anything with the image. Thus, make sure to set in place some strict guidelines that the image will follow after the user admin upload an image via the Featured Image selector.

 

add_theme_support( ‘post-thumbnails’ );
set_post_thumbnail_size( 50, 50, true );
// Normal post thumbnails
add_image_size( ‘sidebar-thumb’, 260, 170, true );
add_image_size( ‘index-thumb’, 300, ”, true );
add_image_size( ‘index-thumb-cropped’, 300, 225,true);
add_image_size( ‘footer-thumb’, 200, 140, true );
add_image_size( ‘archive-thumnb’, 300, 300);
//used to add featured

 

The above code is written in functions.php of your WP theme. In the above code you can see, there are five additional thumbnail sizes with a name. Once the code is added in the functions.php file, the user admin will have a list of the most recent posts, and when using the default featured image to show thumbnails, will pull 50x50px images.

 

Utilizing featured images to the fullest extent ensures greater optimisation of your site. In addition, it helps make your website more mobile-efficient. It also gives addon to Protect Integrity of Responsive WordPress Theme.

 

You may like to read: All about WordPress Hosting for Online Business Services

 

Conclusion:

 

WordPress offers several options to build responsive websites effortlessly. However, a user admin without any knowledge of working on RWD can put the strain on your site which resorts to breakage. So, in order to protect integrity of responsive wordPress theme, I’ve listed 3 RWD rules abiding by which you can safeguard your site from breaking.

Comments

comments

Leave A Reply

Your email address will not be published.