This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| * EASY CUSTOM FIELDS | |
| * Input field | |
| * EXAMPLE | |
| * echo '<pre>'. ecf_input('email', 'Enter Your Email', 'InputName'); | |
| * echo ecf_input(); // defaults | |
| * PARAMETERS | |
| * @param string type | |
| * @param string label |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| * EASY CUSTOM FIELDS | |
| * Input field | |
| * EXAMPLE | |
| * echo '<pre>'. ecf_input('email', 'Enter Your Email', 'InputName'); | |
| * echo ecf_input(); // defaults | |
| * PARAMETERS | |
| * @param string type |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $url = 'http://example.com'; | |
| $validation = filter_var($url, FILTER_VALIDATE_URL, FILTER_FLAG_HOST_REQUIRED); | |
| if ( $validation ) | |
| { | |
| $output = 'proper URL'; | |
| } | |
| else | |
| { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| //https://wpexplorer-themes.com/total/snippets/meta-shortcode/ | |
| /** | |
| * Returns a custom field value | |
| * | |
| * Usage [custom_field id="staff_position"] | |
| * | |
| * Available options... staff_position, staff_twitter, staff_facebook, staff_email...etc |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function get_csvarray($getcsvfile = 'test.csv'){ | |
| $row = 0; | |
| $col = 0; | |
| $gethandle = @fopen($getcsvfile, "r"); | |
| if ($gethandle) { | |
| while (($row = fgetcsv($gethandle, 4096)) !== false) { |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| You could use rename. From inside the directory: | |
| rename -n 's/(.*).{12}/$1/' * | |
| Remove -n after testing to actually rename the files. Replace {12} with {whatever number of characters you want to delete from the end of the name} | |
| Explanation | |
| s/old/new/' replaceoldwithnew` |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /** | |
| * Define type of server | |
| * | |
| * Depending on the type other stuff can be configured | |
| * Note: Define them all, don't skip one if other is already defined | |
| */ | |
| define( 'DB_CREDENTIALS_PATH', dirname( ABSPATH ) ); // cache it for multiple use |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| /* | |
| One wp-config for local development to staging to production. | |
| */ | |
| // Define Environments | |
| $environments = array( |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| $countries = array( | |
| 'AF' => 'Afghanistan', | |
| 'AX' => 'Aland Islands', | |
| 'AL' => 'Albania', | |
| 'DZ' => 'Algeria', | |
| 'AS' => 'American Samoa', | |
| 'AD' => 'Andorra', | |
| 'AO' => 'Angola', |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| function get_ip() { | |
| $ip = '127.0.0.1'; | |
| if ( ! empty( $_SERVER['HTTP_CLIENT_IP'] ) ) { | |
| $ip = $_SERVER['HTTP_CLIENT_IP']; | |
| } elseif ( ! empty( $_SERVER['HTTP_X_FORWARDED_FOR'] ) ) { | |
| $ip = $_SERVER['HTTP_X_FORWARDED_FOR']; |