Useful points to create wordpress theme

Useful points to create WordPress theme

We have listed the some of the important key point which will be useful to create wordpress theme.

PHP standard uses.

https://make.wordpress.org/core/handbook/coding-standards/php/

Uses the file name in lowercase.

Uses the class name in Capitalized case.

Uses the acronyms in the class in Uppercase.

Don’t use the short tags in php  ex:- <?  ?> or <?=  ?>

Uses the esc_attr when we use variable in “ “ or ‘ ’.

Use the tabs at first and uses the spaces in the mig-line.

Use the braces in all condition if it is one line means also.

 For example: if  ( a  >  b ) {

Echo “Analysis for the Theme creation”;

}

Always put spaces after commas, and on both sides of logical, comparison, string and assignment operators.

Use the $wpdb->prepare is a method that handles escaping, quoting, and int-casting for SQL queries.

For example :

$var = “Theme creation’”;

Id = some_post_number();

$wpdb->query( $wpdb->prepare( “UPDATE $wpdb->posts SET post_title = %s WHERE ID = %d”, $var, $id ) );

Avoid maximum the directly uses of the query in the theme try to uses function.

wp-hackers :   people interested in extending WordPress either through plugins or improvements to the core code.

https://make.wordpress.org/core/handbook/inline-documentation-standards/php-documentation-standards/

http://codex.wordpress.org/Function_Reference/wp_remote_request

Theme also must follow the below step to become the best wordpress theme:

-> Calling the script and css files in prepare ways from the function files through this we can using the css and script only in the admin area for the theme option.

-> Test our theme with the theme check plugin and try to slove the issues from

this  plug-in.

-> There are some must needed css for the wordpress theme.ex : wp_caption, aligncenter,etc..,

-> create a dynamic sidebar widget for the theme.

-> Analysis the need of tags.

-> Analysis the text domain problem in the wordpress theme.

-> Need comments.php files.

-> Need screenshot.png is must. Size (880*660) ratio 4:3

-> theme must support the shortcode tags.

->theme also support the avatar or wp_list_comments function.

-> Our theme also need to support the Navigation for the posts or page navigation.

-> comment pagination code is also needed.

-> use  the esc_attr to print the value.

-> use  echo esc_url( home_url() ) instead  bloginfo( ‘url’ ) in header files.

-> don’t use the following ways:

<a href=”index.html”>Home</a>

< a href=”http://www.example.com/brands”>Brands</a>

Use the prepare  ways when we are going give the url.

-> use  wp_nav_menu  function for all menu in the site. Don’t use direct html link it will affect our code standard.

-> follow the folder structure of the wordpress.

-> use the ascii html code for the special character. The special character is not directly used in the website because it is not printable.

-> we need to use the avatar in the website.

-> we need to use the language attributes in the html tags.

<?php language_attributes(); ?>

-> use the post class and id for the post pages.

id=”post-<?php the_ID(); ?>” <?php post_class(); ?>

-> we need to use the comments.php and comment form in our theme.

-> Add the content.php pages and add the wp list page function in that pages.

-> Add the wp comments list pages below the post so that user can comments for their post.

-> put this code in the header.php to support javascript code in the comments.

if ( is_singular() ) wp_enqueue_script( ‘comment-reply’ );

https://codex.wordpress.org/Migrating_Plugins_and_Themes_to_2.7/Enhanced_Comment_Display

-> we need usde the below function in the function.php files:

if ( ! isset( $content_width ) ) {

$content_width = 600;

}

-> we need to use the pagination for the post pages using any pagination function.

-> add theme support  function for header,custom background,title-tags..,

Analysis the theme review document:

Theme Review Document: http://codex.wordpress.org/Theme_Review

-> we need to fix the javascript error aries by the browser

-> don’t call unwanted files in any places because it causes the JavaScript errors. Use this code in wp_config.php files

define(‘SCRIPT_DEBUG’, true);

Folder structures : http://themeshaper.com/2012/10/26/wordpress-theme-template-directory-structure/

Procedure followed by WordPress review team : https://make.wordpress.org/themes/about-old/how-to-join-wptrt/

Guidelines: https://make.wordpress.org/themes/handbook/guidelines/

Test Plugins: https://wordpress.org/plugins/log-deprecated-notices/screenshots/

https://wordpress.org/plugins/debogger/

 

Leave a Reply

Your email address will not be published. Required fields are marked *

Subscribe For Latest Updates

You have successfully subscribed to the newsletter

There was an error while trying to send your request. Please try again.

Sutrula Thalangal will use the information you provide on this form to be in touch with you and to provide updates and marketing.