Best wordpress theme developer india

Jose TVM
email:dscomtvm@gmail.com
phone:91-9847443143
http://www.indiawordpressdeveloper.com

Specialties:
php,HTML, JavaScript, Ajax, Joomla,wordpress,jquery,seo,elgg,magento,php zend,oscommerce and codeigniter.

theme basic config

<?php
if ( ! isset( $content_width ) ) {
$content_width = 660;
}

/**
 * Twenty Fifteen only works in WordPress 4.1 or later.
 */
if ( version_compare( $GLOBALS['wp_version'], '4.1-alpha', '<' ) ) {

}

if ( ! function_exists( 'test_setup' ) ) :
/**
 * Sets up theme defaults and registers support for various WordPress features.
 *
 * Note that this function is hooked into the after_setup_theme hook, which
 * runs before the init hook. The init hook is too late for some features, such
 * as indicating support for post thumbnails.
 *
 * @since Twenty Fifteen 1.0
 */
function test_setup() {

add_theme_support( 'post-thumbnails' );
add_theme_support( 'post-thumbnails', array( 'post' ) );          // Posts only
add_theme_support( 'post-thumbnails', array( 'page' ) );          // Pages only
add_theme_support( 'post-thumbnails', array( 'post', 'movie' ) ); // Posts and Movies

add_theme_support( 'html5', array(
'search-form', 'comment-form', 'comment-list', 'gallery', 'caption'
) );

/*
* Enable support for Post Formats.
*
* See: https://codex.wordpress.org/Post_Formats
*/
add_theme_support( 'post-formats', array(
'aside', 'image', 'video', 'quote', 'link', 'gallery', 'status', 'audio', 'chat'
) );

/*
* Enable support for custom logo.
*
* @since Twenty Fifteen 1.5
*/
add_theme_support( 'custom-logo', array(
'height'      => 248,
'width'       => 248,
'flex-height' => true,
) );



}
endif;
add_action( 'after_setup_theme', 'test_setup' );

function register_my_menu() {
  register_nav_menu('header-menu',__( 'Header Menu' ));
}
add_action( 'init', 'register_my_menu' );
function arphabet_widgets_init() {

register_sidebar( array(
'name'          => 'Home right sidebar',
'id'            => 'home_right_1',
'before_widget' => '<div>',
'after_widget'  => '</div>',
'before_title'  => '<h2 class="rounded">',
'after_title'   => '</h2>',
) );

}
add_action( 'widgets_init', 'arphabet_widgets_init' );

function add_scripts() {
    wp_enqueue_script(
        'custom_script',
        get_template_directory_uri() . '/js/jquery-2.1.1.js',
        array('jquery'),null
    );
     wp_enqueue_script(
        'script',
        get_template_directory_uri() . '/js/script.js',
        array('jquery'),null
    );
}
function add_style() {
  wp_enqueue_style( 'wpse-styles1', get_template_directory_uri() . '/css/zerogrid.css', array(), null );
wp_enqueue_style( 'wpse-styles2', get_template_directory_uri() . '/css/menu.css', array(), null );
wp_enqueue_style( 'wpse-styles3', get_template_directory_uri() . '/css/style.css', array(), null );
wp_enqueue_style( 'wpse-styles4', get_template_directory_uri() . '/font-awesome/css/font-awesome.min.css', array(), null );
wp_enqueue_style('wp_font5',get_template_directory_uri().'/owl-carousel/owl.carousel.css',array(),null);
wp_enqueue_style('wp_font6',get_template_directory_uri().'/owl-carousel/owl.theme.css',array(),null);

}
add_action( 'wp_enqueue_scripts', 'add_scripts' );
add_action( 'wp_enqueue_scripts', 'add_style' );
?>

Wordpress Basic Setup

<?php
/*
Plugin Name: Test Plugin
Plugin URI:  https://developer.wordpress.org/plugins/the-basics/
Description: Basic WordPress Plugin Header Comment
Version:     20160911
Author:      WordPress.org
Author URI:  https://developer.wordpress.org/
License:     GPL2
License URI: https://www.gnu.org/licenses/gpl-2.0.html
Text Domain: wporg
Domain Path: /languages
*/


define( 'TEST_VERSION', '3.2' );
define( 'TEST__MINIMUM_WP_VERSION', '3.7' );
define( 'TEST__PLUGIN_DIR', plugin_dir_path( __FILE__ ) );
define( 'TEST_DELETE_LIMIT', 100000 );

function wporg_custom_post_type()
{
    register_post_type('product',
                       [
                           'labels'      => [
                               'name'          => __('Products'),
                               'singular_name' => __('Product'),
                           ],
                           'public'      => true,
                           'has_archive' => true,
                           'rewrite'     => ['slug' => 'products'], // my custom slug
                       ]
    );
}
add_action('init', 'wporg_custom_post_type');

function pluginprefix_install()
{
    // trigger our function that registers the custom post type
    wporg_custom_post_type();

    // clear the permalinks after the post type has been registered
    flush_rewrite_rules();
}
register_activation_hook( __FILE__, 'pluginprefix_install' );

function pluginprefix_deactivation()
{
    // our post type will be automatically removed, so no need to unregister it

    // clear the permalinks to remove our post type's rules
    flush_rewrite_rules();
}
register_deactivation_hook( __FILE__, 'pluginprefix_deactivation' );

function product_meta_box(){
add_meta_box('raidco-sku-meta-box',
'test',
'test',
'product',
'normal',
'high');
}

add_action('add_meta_boxes','product_meta_box');

function test(){
global $wpdb;
global $post;
wp_nonce_field(__FILE__,'form_csrf');
$test= get_post_meta( $post->ID,'test',true );
?>
<div class="wrap">
<input name="test" class="raidco-controls" style="width:36%" id="test" value="<?php echo $test; ?>" data-validation="test" placeholder="">
<?php
 $url =get_post_meta($post->ID,'my-image-for-post', true);   ?>
    <input id="my_image_URL" name="my_image_URL" type="hidden" value="<?php echo $url;?>"  style="width:400px;" />
    <input id="my_upl_button" type="button" value="Upload Image" /><br/><img src="<?php echo $url;?>" style="width:200px;" id="picsrc" />
</div>

<script>
    jQuery(document).ready( function( $ ) {
        jQuery('#my_upl_button').click(function() {

            window.send_to_editor = function(html) {
                imgurl = jQuery(html).attr('src')
                jQuery('#my_image_URL').val(imgurl);
                jQuery('#picsrc').attr("src",imgurl);
                tb_remove();
            }

            formfield = jQuery('#my_image_URL').attr('name');
            tb_show( '', 'media-upload.php?type=image&amp;TB_iframe=true' );
            return false;
        });

    });
    </script>
<?php
}
function save_product($post_id){
global $post;
update_post_meta( $post->ID,'test',$_POST['test']);
if (isset($_POST['my_image_URL'])){
        update_post_meta($post_id, 'my-image-for-post',$_POST['my_image_URL']);
    }
}

add_action('save_post','save_product');

// product Shortcode
function product_shortcode()
{
  $args = array(
            'post_type' => 'product',
            'post_status' => 'publish'
        );

        $string = '';
        $query = new WP_Query( $args );
        if( $query->have_posts() ){
            $string .= '<ul>';
            while( $query->have_posts() ){
                $query->the_post();
                $string .= '<li>' . get_the_title() . '</li>';
                $string.='<li>'.the_content().'</li>';
            }
            $string .= '</ul>';
        }
        wp_reset_postdata();
        return $string;

}

add_shortcode('product', 'product_shortcode');

//single plugin template

add_filter('single_template', 'my_custom_template');

function my_custom_template($single) {
    global $wp_query, $post;

    /* Checks for single template by post type */
    if ($post->post_type == "product"){
    if ( is_single() ) {
    require(TEST__PLUGIN_DIR . 'test1.php' );
    }
     
    }
    }

    //image custom

    function my_admin_scripts() {  
    wp_enqueue_script('media-upload');
    wp_enqueue_script('thickbox');
    wp_register_script('my-upload', TEST_PLUGIN_URL.'/my-script.js', array('jquery','media-upload','thickbox'));
    wp_enqueue_script('my-upload');
}

function my_admin_styles() {

    wp_enqueue_style('thickbox');
}

// better use get_current_screen(); or the global $current_screen
if (isset($_GET['page']) && $_GET['page'] == 'my_plugin_page') {

    add_action('admin_print_scripts', 'my_admin_scripts');
    add_action('admin_print_styles', 'my_admin_styles');
}

button onclick event example javascript

Here is the example of button click Example javascipt

<button onclick="myFun()">Click me</button>

<p id="demo"></p>
<script>
function myFun()
{
document.getElementById("demo").innerHTML="Test";
}
</script>

Javascript function

A JavaScript function is a block of code designed to perform a particular task.
A JavaScript function is executed when "something" calls it

Here is Example Of javascript function
<script>
function myfun(p,p1)
{
return p * p1;
}
document.getElementById("test").innerHTML=myfun(4,1);

</script>

Javascript Objects

JavaScript objects are written with curly braces.Object properties are written as name:value pairs, separated by commas.

Here is Example of object

<p id=""></p>
<script>
var per={name:"bipin",sex:"male",age:"20"}

document.getelementById("test").innerHTML=per.name +""+ per.sex+"";


</script>


javascript array

Javascript array declare in square brackets and array ithem are seperated by commas


Here is Example of array in javascript

<p id="test"> </p>

<script>
var car=["honda","maruti","tata"];
getElementById("test").innerHTML=car[0];

</script>

0utput will get honda..



How can add value to variable

we can use += operater to add a value to varable

For example

<p id="test">  </p>

<script>

var a;

a=10;
a+=10;

document.getElementById("test").innerHTML=a;




</srcipt>

How can concatenate String in javascript

+ operator used for concatenate string in Javascript

We can also use += operator for concatenate string

Example like

var a,b,c;
a="test";
b="test1";
c= a+ " " + b;



what is Value = undefined in javascript

a variable declare a value not defind that is called undefind

For Example
<p id="test">
<script>
Var a;

document.getElementById("test").innerHTML=a;

</script>

Javascript Comment


There are two type comment in javascipt 

one is single line comment

//
other one is multi line comment

/*

*/

How Can Assigning value in javascript

How Can Assigning value in javascript


We can assign value in javascript in = sign


Here is the Example of code

<p id="test"></p>

<script>
var a,b
a=10;
b=10
document.getElementById("test").innerHML=a+b;
</script>

Output will be 20 ...

Simple Example of Javascript

<!DOCTYPE html>
<html>
<body>

<h1>Simple Example of javascript</h1>

<p id="demo">Test</p>

<button type="button" onclick='document.getElementById("demo").innerHTML = "Hello JavaScript!"'>Click Me!</button>

</body>
</html>

it will display out

Simple Example of javascript

Hello JavaScript!


What is javascript

JavaScript is programming language of html and Web. JavaScript  is dynamic and high level and interpreted programming language also it easy to study for learners

How can create a plugin in elgg

I would like to share some basics about plugin development in elgg . 

In elgg all the plugins will be in mod directory. You can drop your plugin in this directory.

First you need a name for your plugin.The names of the plugins in an installation must be unique. 


you need a ‘start.php’ file for each plugin which to describe the common functions for a plugin.This file can be considered as the core controller of all plugins .The start.php must have an init function which initializes the plugin . 

You have to register this function to elgg system and have to make sure the initialisation function is called on initialisation. 

The following is a sample if the init functuion is yourplugin_init() 

register_elgg_event_handler('init','system',’yourplugin _init'); 


In common the elgg plugin will have following folders 

actions : Commonly all action(normally form actions) files are saved in this folder. 

And you can register all the actions involved in a plugin with in its start.php file 

The function is as follows .

register_action($action, $public = false, $filename = "", $admin_only = false) 

For example 

register_action('blog/add',false,$CONFIG->pluginspath . "blog/actions/add.php"); 

the parameters of the register_action indicates

action : The name of the action (here "blog/add")

second parameter is a Boolean parameter.which indicates whether the action is public or not that is whether this action be accessed by people not logged into the system or not.In above example false indicates that it is not a public action.

Next is filename that is where the action is located here the action is located in blog/actions/add.php , $CONFIG->pluginspath gives the path to plugin s that is the full path to mod directory of your elgg installation .

And if it is required you can register the action as admin action .you have to set the fourth parameter as true for this by default it in false.


Views : In common all html files will be in this folder .You can call these views in the plugin using the function

elgg_view(‘viewname’,$array_of params) 

You can override existing views also.The view lodes based on the plugin priority.

You can extend views using the function extend_view('original view ','your view'); 


The view folder contains a default folder which holds all the views of plugin .For the easiness .For the easiness you can use subfolders in the default folder.

For example if you have a plugin named blog and it have a view called create.php in the path views /defaults/blogs/create.php you can call this view like ‘blogs/create ‘ .That is you can call the view as follows elgg_view(‘blogs/create’) 

Language file : 

This file contains the language translations for the plugin.

Creating Friendly URLS:

You can create nice URLs for your plugin using page handler function.for doing this you have to define and register a page handler in `start.php`, 


function handlerfunction($page) {

switch ($page[0])

{

case 'index':

Your code for the index view

break;

case 'your_view':

include(‘yourview’);

break; 

}

} 

register_page_handler(handler, 'handler_function’);

in this function the first argument handler is your entity type, the next argument is the your plugin function handling the request which will get passed as an array in `$page` this carries each url segments. You can check for a location and can create the cases corresponding to that.



User settings: 

Plugins might have some settings , You can create the view in the file settings.phpand you can retrieve the settings by the following function

get_plugin_setting($name, $plugin_name );

and you can set values using 

set_plugin_setting($name, $value, $plugin_name);function 

You can create widgets on your plugins .The widget might be in the folder views/default/widgets

The widgets folder may have two files one is view.php that is view of widget and the other is eidt.php that is the page for setting the widget display options like number of items to be displayed etc. 

You can initialize the widget in the init function using the following function 

add_widget_type('widgettitle',$name_of_widget,$desc_of_widget) .

simple explode program in php

<?php
//explode string into array
$str=" Test Explode function in php ";
print_r (explode(" ",$str));

?>

it will be Output like:

Array ( [0] => [1] => Test [2] => Explode [3] => function [4] => in [5] => php [6] => )

simple example php function

<?php
//simple example php function
function welcome()
{
echo "Welcome to Function";
}
welcome();
?>

how can create notepad file in php

<?php
//how can create notepad file in php
$t= fopen("testfiles.txt", "w") or die("Unable to open file!");
$txt = "John Doe\n";
fwrite($t, $txt);
$txt = "Jane Doe\n";
fwrite($t, $txt);
fclose($t);

?>