forked from neojp/gravity-forms-placeholders
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathgravityforms-placeholders.php
More file actions
executable file
·31 lines (23 loc) · 1.06 KB
/
gravityforms-placeholders.php
File metadata and controls
executable file
·31 lines (23 loc) · 1.06 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
<?php
/*
Plugin Name: Gravity Forms - Placeholders add-on
Plugin URI: http://github.com/neojp/gravity-forms-placeholders/
Description: Adds HTML5 placeholder support to Gravity Forms' fields with a javascript fallback. Javascript & jQuery are required.
Version: 1.2.3
Author: Joan Piedra
Author URI: http://joanpiedra.com
Instructions:
Just add a "gplaceholder" CSS classname to the required fields or form
*/
if ( isset( $GLOBALS['pagenow'] ) && $GLOBALS['pagenow'] == 'wp-login.php' )
return;
// look into using wp_localize_script instead
function gf_placeholder_print_scripts() {
$plugin_dir = plugin_dir_url( __FILE__ );
echo "<script>var jquery_placeholder_url = '" . $plugin_dir . "jquery.placeholder-1.0.1.js';</script>";
}
add_action( 'wp_print_scripts', 'gf_placeholder_print_scripts' );
function gf_placeholder_enqueue_scripts() {
wp_enqueue_script( 'gf_placeholders', plugins_url( 'gf.placeholders.js', __FILE__ ), array( 'jquery' ), '1.0.1', true );
}
add_action( 'wp_enqueue_scripts', 'gf_placeholder_enqueue_scripts' );