Ronald Joseph

I am professional Web Developer working as Professionally and freelancer in Pakistan

How To Create a Custom post Type — March 4, 2014

How To Create a Custom post Type

<code>add_action(‘init’, ‘member’);

function member() {

$labels = array(

‘name’ => _x(‘Our Members’, ‘post type general name’),

‘singular_name’ => _x(‘Our Members’, ‘post type singular name’),

‘add_new’ => _x(‘Add New’, ‘Our Members item’),

‘add_new_item’ => __(‘Add New Our Members Item’),

‘edit_item’ => __(‘Edit Our Members Item’),

‘new_item’ => __(‘New Our Members Item’),

‘view_item’ => __(‘View Our Members Item’),

‘search_items’ => __(‘Search Portfolio’),

‘not_found’ =>  __(‘Nothing found’),

‘not_found_in_trash’ => __(‘Nothing found in Trash’),

‘parent_item_colon’ => ”

);

$args = array(

‘labels’ => $labels,

‘public’ => true,

‘publicly_queryable’ => true,

‘show_ui’ => true,

‘query_var’ => true,

‘menu_icon’ => get_stylesheet_directory_uri() . ‘/images/admin/wp-logo-small.png’,

‘rewrite’ => true,

‘capability_type’ => ‘post’,

‘hierarchical’ => false,

‘menu_position’ => null,

//’supports’ => array(‘title’,’editor’,’author’,’thumbnail’,’post-thumbnails’,’excerpts’,’trackbacks’,’custom-fields’,’comments’,’revisions’,’page-attributes’)

‘supports’ => array(‘title’,’editor’,’thumbnail’,’custom-fields’)

);

register_post_type( ‘member’ , $args );

}

 </code>

 <code>

<?php $index_query = new WP_Query(array( ‘post_type’ => ‘member’, ‘posts_per_page’ => 4 )); ?>

<?php while ($index_query->have_posts()) : $index_query->the_post(); ?>

<?php endwhile; ?></code>

How to print a String in reverse order — February 10, 2014

How to print a String in reverse order

Most to time this question is asked in Interview, how can we print a string in reverse order with for loop


//error_reporting(NULL);
$string = trim("This is a reversed string");

//find length of string including whitespace
$len =strlen($string);

//slipt sting into an array
$stringExp = str_split($string);

for ($i = $len - 1; $i >=0;$i--)
{
echo $stringExp[$i];
}

OR

you can use


<?php
echo strrev("Hello world!");

// Result :  outputs "!dlrow olleH"
?>
WordPress As An Ecommerce Site — August 28, 2013

WordPress As An Ecommerce Site

Whenever you hear about WordPress and or WordPress website, the first come in your mind it’s a blogging site.Wordpress.org has vast range of plugin in his library and also have E-commerce plugin also which is easy to install and operate after a reading through plugin manual.

Building an E-commerce site is not an easy task, you don’t know where to start and implement design to navigation and infrastructure, and you can be left with your head spinning, wondering where to begin in the world. Using the Plugin which are as following, you can develop very handy and easy wordpress E-commerce site. Example e-commerce Plugins:

  • WP e-commerce
    wp-commerce
  • WooCommerce
    woocommerce
  • Cart66 Lite:: WordPress Ecommerce
    cart66
  • iThemes Exchange: Simple Ecommerce
    itheme

If you are well familiar with the admin of wordpress and structure of posting and publishing pages or posts, then it would not be difficult for you to work on any wordpress e-commerce plugin. Also one should maintain these following steps to make a good e-commerce website.

  • Showcase Your Top Sellers
     You should display top sell brands at your index page, it will attract the client and also bring lot of business to your website.
  • Checkout Page: Make It Easy
    The simplest ways for you to make checkout simple for your customers is to reduce the amount of information they need to fill in or provide.
  • User SignUp Form easy
    Signup Process should be simple and fast so user can buy product very fast with any hurdles of filling long forms and also provide social, secure checkout system like Paypal and Sagepay etc.

But I mention only few point for building the e-commerce site, you can building your own strategy before building e-commerce site. Work with the right hosting company that can offer you all of the storage, security and other functionality you want for your WordPress site.

How To Speed Up WordPress —

How To Speed Up WordPress

Everyone hates slow websites and also decrease the user rating and ranking in search engine. You need to make sure that the CSS, JS and all images on the theme are optimized for the web. Your theme should be responsive and attractive to visitor’s eyes, but it should be a light weight so that website can load very fast on visitor’s browsers. While developing wordpress you keep few things in mind to speed up wordpress site.

·       Minify HTML, CSS, and Javascript

·       Gzip and compress components

·       Put stylesheets at the top

·       Put scripts at the bottom

·       Utilize browser caching

Also you can Find many plugin from wordpress.org e.g like w3 cache plugin and wp minify and many more.