implement jquery UI datepicker in wordpress

wordpress and jquery both are powerful tool. In plugin we need datepicker sometime. In this article i showed how to implement jquery UI datepicker in wordpress

implement jquery UI datepicker in wordpress

Some WP developers use the plugins to add the datepicker in wordpress. But you can add the Jquery datepicker in wordpress. How can use the Jquery UI in your wordpress theme and plugin using following code.  For adding the datepicker in theme you need to just add the following code in functions.php file.

[viral-lock message=”Some Source code is Hidden! It’s Visible for Users who Liked/Shared This article on Facebook or Twitter or Google+. Like or Tweet this article to reveal the content.”]


add_action( 'init', 'wpapi_date_picker' );
function wpapi_date_picker() {
    wp_enqueue_script( 'jquery' );
    wp_enqueue_script( 'jquery-ui-core' );
    wp_enqueue_script( 'jquery-datepicker', 'http://jquery-ui.googlecode.com/svn/trunk/ui/jquery.ui.datepicker.js', array('jquery', 'jquery-ui-core' ) );
}

add_action( 'wp_footer', 'wpapi_print_scripts');
function wpapi_print_scripts() {
    ?>
<script type="text/javascript">
    jQuery(document).ready(function() {
        jQuery('#datepicker').datepicker();
    })
</script>
    <!--?<span class="hiddenSpellError" pre="" data-mce-bogus="1"-->php
}

[/viral-lock]

For showing the datepicker control in theme or plugin use following code.

<script type="text/javascript">
jQuery(document).ready(function() {
    jQuery('#datepicker').datepicker({
        dateFormat : 'yy-mm-dd'
    });
});
</script>
implement jquery UI datepicker in wordpress
implement jquery UI datepicker in wordpress

If you have any issue for adding the datepicker control then please add comment or email me.

kill spam wordpress comments by changing comment file

In Article, we tell you about how to change the filename of wp-comments-post.php file another name. and kill spam wordpress comments by changing filename.

kill spam wordpress comments by changing filename wp-comments-post.php

With WordPress blogs and sites spam comments is very big issue. That waste our lot of time. There is very nice plugin called Akismet by wordpress. Which is helpful for catching the spam comments but that is not smart enough. Some spambots simply hit the wp-comments-post.php and wp-trackback.php files directly, without scanning your site to find the real names of these scripts. You can foil such bots by renaming these files. My site is also faced the spam comments and hack issues by spmmers. So following trick is very useful.

This files will not track which comment is spam. In this tutorial I will tell you about how to change the filename of wp-comments-post.php file another name. This way you can easily protect your blog against spammer comments.

You need to just follow the steps:

  1. Back up all your files.
  2. Replace all instances of wp-comments-post.php in your theme template files with wp-comments-kill-spam.php. In most themes, this will mean editing comments.php and comments-popup.php; it’s a good idea to double-check by searching through all files in your theme directory with the “find and replace” feature of your favorite editor.
  3. Upload your edited template files.
  4. Rename your wp-comments-post.php file to wp-comments-die-spam-die.php. Be sure that wp-comments-post.php is gone when you’re done, or spammers will still be able to use it!
  5. (Optional) Create a blank file and name it wp-comments-post.php. This will prevent spambots from getting a 404 error. If your 404 page is large, this will save you some bandwidth; it might also keep the spammers from catching on to your trick.
  6. Check that everything works by posting a test comment to your blog.

You will find following code in comments.php file.


<form action="<!--?php echo get_option('siteurl'); ?-->/wp-comments-post.php" method="post" id="commentform">

just replace to that as follows:


<form action="<!--?php echo get_option('siteurl'); ?-->/<tt>wp-comments-kill-spam.php</tt>" method="post" id="commentform">

This is simple way to protect your blog without any wordpress plugin. This tip is written by purabtech.in

If you are having any issue then please write to me support@purabtech.in.

kill spam wordpress comments by changing comment file
kill spam wordpress comments by changing comment file

Use PHP in Rails project

Many times you need to use PHP scripts in Rails project. You will got so much open source PHP scripts for various use.

Example is So many Rails site is using WordPress for blogging system.

Main reason behind using PHP files or script is SEO. PHP is a very SEO friendly.

Customer does not want to spend money or time already existing scripts or program.

If you want to use PHP files or project under Rails project. Just create any folder in Public directory and put your php files in to that folder.

lets say you created the “fourm” dir in public directory.

You need to add following lines in your apache rule file(httpd.conf)

LoadModule proxy_module modules/mod_proxy.so

LoadModule proxy_http_module modules/mod_proxy_http.so

Under <VirtualHost  *:80> tag add following lines:

ProxyRequests Off

RewriteEngine On

RewriteCond  %{HTTP_HOST}    ^example.com [NC]
RewriteCond %{REQUEST_URI}  !^/forum(.*)$ [NC]

RewriteCond  %{HTTP_HOST}    ^example.com [NC]

RewriteRule ^/forum/?(.*)$ /document_root/forum/$1 [QSA,NC,L]

Than you are able to use PHP code or scripts in Rails project