Wednesday, 25 December 2013

How To Use AJAX In WordPress

In the last few years, AJAX has crept onto websites and slowly become the way to create dynamic, user-friendly, responsive websites. AJAX is the technology that lets you update the contents of a page without actually having to reload the page in the browser. For example, Google Docs utilizes this technology when saving your work every few minutes.
sm-ajax-2011
While there are a number of ways to use AJAX in WordPress — and all are “correct,” in the loose sense of the word — there is one method that you should follow for a few reasons: WordPress supports it, it is future-proof, it is very logical, and it gives you numerous options right out of the box.

Sunday, 22 December 2013

I need to build a site for a client. How will Joomla! help me?



Simple Admin interface Joomla is designed to be easy to install and set up even if you're not an advanced user. Many Web hosting services offer a single-click install, getting your new site up and running in just a few minutes.
Since Joomla is so easy to use, as a Web designer or developer, you can quickly build sites for your clients. Then, with a minimal amount of instruction, you can empower your clients to easily manage their own sites themselves.
If your clients need specialized functionality, Joomla is highly extensible and thousands of extensions (most for free under the GPL license) are available in the Joomla Extensions Directory.

What is Joomla?

Joomla is an award-winning content management system (CMS), which enables you to build Web sites and powerful online applications. Many aspects, including its ease-of-use and extensibility, have made Joomla the most popular Web site software available. Best of all, Joomla is an open source solution that is freely available to everyone.

What's a content management system (CMS)?

A content management system is software that keeps track of every piece of content on your Web site, much like your local public library keeps track of books and stores them. Content can be simple text, photos, music, video, documents, or just about anything you can think of. A major advantage of using a CMS is that it requires almost no technical skill or knowledge to manage. Since the CMS manages all your content, you don't have to.

What are some real world examples of what Joomla! can do?

Joomla is used all over the world to power Web sites of all shapes and sizes. For example:
  • Corporate Web sites or portals
  • Corporate intranets and extranets
  • Online magazines, newspapers, and publications
  • E-commerce and online reservations
  • Government applications
  • Small business Web sites
  • Non-profit and organizational Web sites
  • Community-based portals
  • School and church Web sites
  • Personal or family homepages
  •  

Saturday, 21 December 2013

Widgets API

This page contains the technical documentation for the WordPress Widgets API and is written for developers. If you're not a developer you may want to review the Widgets page.
In technical terms: a WordPress Widget is a PHP object that echoes string data to STDOUT when its widget() method is called. It's located in wp-includes/widgets.php.

Codex

Function Reference/is active widget

Contents

[hide]

Description

This Conditional Tag checks whether widget is displayed on the front-end.
To be effective this function has to run after widgets have initialized, at action 'init' or later.

Usage

 <?php is_active_widget( $callback, $widget_id, $id_base, $skip_inactive ); ?> 

Parameters

$callback
(string) (optional) Widget callback to check.
Default: False
$widget_id
(int) (optional) Widget ID. Needed for checking.
Default: None
$id_base
(string) (optional) Base ID of a widget created by extending WP_Widget.
Default: None
$skip_inactive
(boolean) (optional) Whether to check in 'wp_inactive_widgets'.
Default: True

Return Values

(mixed) 
Returns false if the specified widget is not active, or the id of the sidebar in which the widget is active. If the callback is non-unique you can optionally specify the ID of the widget.

Examples

Only load a script when the widget is active

<?php
if ( is_active_widget( false, false, $this->id_base, true ) ) {
 wp_enqueue_script( 'jquery' );
}
?>

Change Log

Since: 2.2.0

Source File

is_active_widget() is located in wp-includes/widgets.php.

Friday, 20 December 2013

Remove side space in string


avascript Trim Functions

Use the code below to make trim a method of all Strings. These are useful to place in a global Javascript file included by all your pages.

String.prototype.trim = function() {
    return this.replace(/^\s+|\s+$/g,"");
}
String.prototype.ltrim = function() {
    return this.replace(/^\s+/,"");
}
String.prototype.rtrim = function() {
    return this.replace(/\s+$/,"");
}

// example of using trim, ltrim, and rtrim
var myString = " hello my name is ";
alert("*"+myString.trim()+"*");
alert("*"+myString.ltrim()+"*");
alert("*"+myString.rtrim()+"*");

Javascript Trim Stand-Alone Functions

If you prefer not to modify the string prototype, then you can use the stand-alone functions below.

function trim(stringToTrim) {
    return stringToTrim.replace(/^\s+|\s+$/g,"");
}
function ltrim(stringToTrim) {
    return stringToTrim.replace(/^\s+/,"");
}
function rtrim(stringToTrim) {
    return stringToTrim.replace(/\s+$/,"");
}

// example of using trim, ltrim, and rtrim
var myString = " hello my name is ";
alert("*"+trim(myString)+"*");
alert("*"+ltrim(myString)+"*");
alert("*"+rtrim(myString)+"*");

Remove side space in string

What is the difference between plugins and widgets?


Plugins are functions that do something to your website. They could serve a back-end purpose and never be visible to you or the public. In the other hand, a widget usually is the representation of a plugin in the form of an object that can be placed somewhere on your website via the widgets interface under the appearance menu.

Widgets are always plugins, but plugins don’t always have widgets. A widget usually is a pretty and easy way of using a plugin. I hope this short explanation clears some things up if you’re just starting with WordPress.

What is the difference between plugins and widgets?
Plugins are functions that do something to your website. They could serve a back-end purpose and never be visible to you or the public. In the other hand, a widget usually is the representation of a plugin in the form of an object that can be placed somewhere on your website via the widgets interface under the appearance menu.
Widgets are always plugins, but plugins don’t always have widgets. A widget usually is a pretty and easy way of using a plugin. I hope this short explanation clears some things up if you’re just starting with WordPress.
- See more at: http://www.naveenos.com/2010/06/wordpress-widgets-vs-plugins-what%e2%80%99s-the-difference.html#sthash.2qRFRtPK.dpuf
What is the difference between plugins and widgets?
Plugins are functions that do something to your website. They could serve a back-end purpose and never be visible to you or the public. In the other hand, a widget usually is the representation of a plugin in the form of an object that can be placed somewhere on your website via the widgets interface under the appearance menu.
Widgets are always plugins, but plugins don’t always have widgets. A widget usually is a pretty and easy way of using a plugin. I hope this short explanation clears some things up if you’re just starting with WordPress.
- See more at: http://www.naveenos.com/2010/06/wordpress-widgets-vs-plugins-what%e2%80%99s-the-difference.html#sthash.2qRFRtPK.dpuf
What is the difference between plugins and widgets?
Plugins are functions that do something to your website. They could serve a back-end purpose and never be visible to you or the public. In the other hand, a widget usually is the representation of a plugin in the form of an object that can be placed somewhere on your website via the widgets interface under the appearance menu.
Widgets are always plugins, but plugins don’t always have widgets. A widget usually is a pretty and easy way of using a plugin. I hope this short explanation clears some things up if you’re just starting with WordPress.
- See more at: http://www.naveenos.com/2010/06/wordpress-widgets-vs-plugins-what%e2%80%99s-the-difference.html#sthash.2qRFRtPK.dpuf
What is the difference between plugins and widgets?
Plugins are functions that do something to your website. They could serve a back-end purpose and never be visible to you or the public. In the other hand, a widget usually is the representation of a plugin in the form of an object that can be placed somewhere on your website via the widgets interface under the appearance menu.
Widgets are always plugins, but plugins don’t always have widgets. A widget usually is a pretty and easy way of using a plugin. I hope this short explanation clears some things up if you’re just starting with WordPress.
- See more at: http://www.naveenos.com/2010/06/wordpress-widgets-vs-plugins-what%e2%80%99s-the-difference.html#sthash.2qRFRtPK.dpuf

WordPress Widgets vs Plugins, what’s the difference?

June 15, 2010 | In: Wordpress
What is the difference between plugins and widgets?
Plugins are functions that do something to your website. They could serve a back-end purpose and never be visible to you or the public. In the other hand, a widget usually is the representation of a plugin in the form of an object that can be placed somewhere on your website via the widgets interface under the appearance menu.
Widgets are always plugins, but plugins don’t always have widgets. A widget usually is a pretty and easy way of using a plugin. I hope this short explanation clears some things up if you’re just starting with WordPress.
- See more at: http://www.naveenos.com/2010/06/wordpress-widgets-vs-plugins-what%e2%80%99s-the-difference.html#sthash.B7nYeAxf.dpuf

WordPress Widgets vs Plugins, what’s the difference?

June 15, 2010 | In: Wordpress
What is the difference between plugins and widgets?
Plugins are functions that do something to your website. They could serve a back-end purpose and never be visible to you or the public. In the other hand, a widget usually is the representation of a plugin in the form of an object that can be placed somewhere on your website via the widgets interface under the appearance menu.
Widgets are always plugins, but plugins don’t always have widgets. A widget usually is a pretty and easy way of using a plugin. I hope this short explanation clears some things up if you’re just starting with WordPress.
- See more at: http://www.naveenos.com/2010/06/wordpress-widgets-vs-plugins-what%e2%80%99s-the-difference.html#sthash.B7nYeAxf.dpuf

Monday, 7 October 2013

Custom Short Code Creation

Add this Short Code function in main plugin file


add_shortcode('love', 'fun_love');
function fun_love()
{ 
    include "fun_love.php"; //include out put file in this function
}



function validate()
{
    var delete_data=confirm("Do you really want to delete this row?");
    if(delete_data==false)
    {
        return false;
    }
    else
    {
        return true;
    }
}

</script>

</head>

<body>
<div class="wrap">
     global $wpdb;
     $url = admin_url( 'admin.php?page=add-love', '' );
     $url2 = admin_url('admin.php?page=love/love_table.php', '');
   
     $table_name = $wpdb->prefix . "tbllove";
   

$query="SELECT * FROM $table_name  ";
     $row=$wpdb->get_results($query);
   
     //Get Admin Page parent
   
     //$a=get_admin_page_parent();
     //echo "<br/>"."Admin Page parent is :".$a."<br/>";
   
     //Get Plugin URL
   
     //$plugins_url = plugins_url();
     //echo "<br/>"."Plugin URL : ".$plugins_url."<br/>";
   
     //Get Admin URL
   
     //$adminurl=get_admin_url();
     //echo "<br/>"."Admin URL : ".$adminurl;
   
     ?>
   
     <table width='600' border='1' class='widefat'>
     <thead>
          <tr>
             <th>Id</th>
             <th>Name</th>
             <th>Image</th>
             <th>Junder</th>
             <th>Love_id</th>
             <th>With_love</th>
        </tr>
     </thead>
    
     <tr>
     <?php
   
     foreach ( $row as $row1 )
     {
    // $upload_dir=wp_upload_dir();
     $TARGET_PATH="/wp-content/uploads/love_images/";
    //echo $TARGET_PATH.$row1->image;
    $path=get_site_url().$TARGET_PATH;
     //echo plugins_url('love/upload/');
         $id=$row1->id;
     ?>
        <td><?php echo $row1->id; ?></td>
         <td><?php echo $row1->Name; ?></td>
        <td><img src="<?php echo $path.$row1->image; ?>" width="40" height="40"/></td>
        <td><?php echo $row1->Junder; ?></td>
        <td><?php echo $row1->love_id; ?></td>
        <td><?php echo $row1->With_love; ?></td>
          
     
    </tr>
        <input name='id' type='hidden' value='$id'/>
    <?php
     }
    ?>
     </table>

    </div>
</body>
</html>