This file contains 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
Using a regx search, search your file for... | |
[\r\n]{2,} | |
...and replace with ... | |
\n |
This file contains 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
/* | |
Add custom stylesheet into plugin admin. | |
This method appends the plugin version number to the stylesheet for easy CSS cache busting. | |
If your plugin is at version 1.0 the styesheet URL will look like this: | |
https://example.com/wp-content/plugins/your-plugin/css/your-plugin-style.css?ver=1.0 | |
Any time you update your plugin version number, the query string value will match it. | |
*/ | |
function your_plugin_style() { |
This file contains 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
/* Check if css file of slug name exists and if it does, include stylesheet for that slug */ | |
function check_for_css() { | |
global $post; | |
$post_slug = $post->post_name; | |
$filename = get_template_directory() . '/css/' . $post_slug . '.css'; | |
if (file_exists($filename)) { | |
echo '<link rel="stylesheet" id="' . $post_slug . '-css" href="' . get_template_directory_uri() . '/css/' . $post_slug . '.css" type="text/css" media="all" />'; | |
} |
This file contains 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
/* jQuery */ | |
$( document ).ready(function() { | |
window.scroll(0,400); | |
}); |
This file contains 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
/* | |
Add to functions.php | |
*/ | |
add_action( 'gform_after_submission_2', 'capture', 10, 2 ); /* gform_after_submission_2 = form ID 2 */ | |
function capture( $entry, $form ) { | |
global $wpdb; | |
$table= $wpdb->prefix . 'my_table'; | |
$end_date = $entry['4']; /* Field ID 4 */ |
This file contains 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 /* | |
Check if css file of slug name exists and if it does, include stylesheet for that slug. | |
Place in functions.php or make it a plugin. | |
What is this for? | |
If you need to add some custom CSS for a particular page, then this script will make that possible. | |
Simply create a .css file with the name of the page slug (example: about-our-company.css) and place it in the theme /css/ folder. | |
This CSS file will be automatically loaded when the page is visited. |
This file contains 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 | |
// The template | |
$template = 'my-custom-script.php'; | |
// If a template file exists in the theme folder, use it. | |
if ( $theme_file = locate_template( array( 'my-custom-files/' . $template ) ) ) { | |
include(get_template_directory() . '/my-custom-files/' . $template); | |
} else { // Otherwise, use the plugin template file. | |
include(plugin_dir_path( __FILE__ ) . '/templates/' . $template); | |
} |
This file contains 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 | |
/* | |
You'll need to get an API key. | |
Go to https://developers.google.com/fonts/docs/developer_api and scroll down to the 'Gey a Key' button. | |
*/ | |
$api_key = "your-key-here"; | |
$google_font = isset($options['google_font']) ? $options['google_font'] : ''; | |
$url = 'https://www.googleapis.com/webfonts/v1/webfonts?key=' . $api_key; | |
$args = array( | |
'timeout' => 15, |
This file contains 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 my_current_plugin_version() { | |
$plugin_data = get_plugin_data( __FILE__ ); | |
return $plugin_data['Version']; | |
} | |
function my_remote_plugin_version() { | |
$str = file_get_contents('https://rocketapps.com.au/files/open-graphite-pro/open-graphite-pro/info.json'); | |
$json = json_decode($str, true); | |
return $json['version']; | |
} |
OlderNewer