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 | |
add_action( 'gform_enqueue_scripts', 'your_prefix_add_scripts' ); | |
function your_prefix_add_scripts($form) { | |
echo '<script> | |
document.addEventListener( "DOMContentLoaded", function( e ) { | |
if ( typeof jQuery !== "undefined" ) { | |
jQuery(document).on( "click", "#gform_' . $form['id'] . ' [type=submit]", function(e) { | |
if( jQuery(this).data("isclicked" ) === true ) { | |
e.preventDefault(); |
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 | |
$args_cpt = [ | |
'public' => true, | |
'show_ui' => true, | |
'capability_type' => 'post', | |
'hierarchical' => false, | |
'rewrite' => [ | |
'slug' => 'test-cpt', | |
'with_front' => true, |
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 | |
add_action( 'pre_get_posts', function( \WP_Query $query ) { | |
if( ! is_admin() && $query->is_main_query() && $query->is_search() ) { | |
$meta_query = [ | |
'relation' => 'OR', | |
[ | |
'key' => '_yoast_wpseo_meta-robots-noindex', | |
'value' => '1', | |
'compare' => '!=', |
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
<select> | |
<option value="Africa/Algiers">Africa/Algiers</option> | |
<option value="Africa/Cairo">Africa/Cairo</option> | |
<option value="Africa/Casablanca">Africa/Casablanca</option> | |
<option value="Africa/Harare">Africa/Harare</option> | |
<option value="Africa/Nairobi">Africa/Nairobi</option> | |
<option value="America/Argentina/Buenos_Aires">America/Argentina/Buenos_Aires</option> | |
<option value="America/Belize">America/Belize</option> | |
<option value="America/Bogota">America/Bogota</option> | |
<option value="America/Boise">America/Boise</option> |
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 | |
class Radish_GF_Azure_HandleUploads { | |
private static $instance; | |
public function __construct() { | |
$this->run(); | |
} |
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
==== Javascript ==== | |
``` | |
$('.post-count').each( function() { | |
var postid = $(this).attr('id'); | |
$.ajax({ | |
url: uprs.ajax_url, | |
type: 'post', | |
dataType: 'html', | |
cache: false, |
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 | |
$database_name=''; | |
$database_username=''; | |
$database_password=''; | |
$connection = mysqli_connect('localhost',$database_username,$database_password); | |
if(!$connection) { | |
echo "Cannot connect to the database – incorrect details"; |
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 | |
// Put this in your functions.php or in a separate plugin if you want to show all locaitons on one page | |
add_action( 'pre_get_posts', 'wpseo_local_show_all_locations' ); | |
function wpseo_local_show_all_locations( $query ) { | |
if( false == $query->is_main_query() || false == is_post_type_archive( 'wpseo_locations' ) ) { | |
return; | |
} | |
$query->set( 'posts_per_page', -1 ); |
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 | |
// Load all widgets from /lib/widgets directory | |
$widgets_path = STYLESHEET_PATH . 'lib/widgets'; | |
$widgets_dir = @opendir( $widgets_path ); | |
$widgets = array(); | |
if ($widgets_dir) { | |
while (($entry = @readdir($widgets_dir)) !== false) { |
NewerOlder