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 | |
/* | |
Plugin Name: TEST NOTICE | |
*/ | |
function test_notice(){ | |
add_action( 'admin_notices', function (){ | |
echo '<div class="updated"><p>Activated</p></div>'; | |
} ); |
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 | |
add_filter('query_vars', function($vars){ | |
$vars[] = 'featured'; | |
return $vars; | |
}); | |
add_action('init', function(){ | |
add_rewrite_rule('sponsors/test/?$', 'index.php?post_type=sponsors&featured=true', 'top'); |
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
body { | |
padding:100px; | |
} | |
.top { | |
position:absolute; | |
top:0; | |
left:0; | |
} |
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 | |
add_filter('query_vars', function($vars){ | |
$vars[] = 'customendpoint'; | |
return $vars; | |
}); | |
/* set up rewrite rule */ | |
add_action('init', function(){ |
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
function __construct() { | |
add_action( 'admin_print_scripts-widgets.php', function(){ | |
if (is_admin()){ //test fails b/c the admin_print_scripts-widget.php is not aware that is_admin() is true... | |
wp_enqueue_style( 'spw-admin', plugins_url( 'css/' . 'spw-admin.min.css', dirname( __FILE__ ) ), false, 1 ); | |
wp_enqueue_script( 'spw-admin', plugins_url( 'javascripts/' . 'spw-admin.min.js', dirname( __FILE__ ) ), array( 'jquery' ), 1, true ); | |
} | |
} ); | |
} |
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
matthews-mbp-2:bin mat$ ./install-wp-tests.sh test test test localhost latest | |
+ install_wp | |
+ mkdir -p /tmp/wordpress/ | |
+ '[' latest == latest ']' | |
+ local ARCHIVE_NAME=latest | |
+ wget -nv -O /tmp/wordpress.tar.gz http://wordpress.org/latest.tar.gz | |
2014-02-06 18:04:20 URL:http://wordpress.org/latest.tar.gz [5869727/5869727] -> "/tmp/wordpress.tar.gz" [1] | |
+ tar --strip-components=1 -zxmf /tmp/wordpress.tar.gz -C /tmp/wordpress/ | |
+ wget -nv -O /tmp/wordpress//wp-content/db.php https://raw.github.com/markoheijnen/wp-mysqli/master/db.php | |
2014-02-06 18:04:22 URL:https://raw.github.com/markoheijnen/wp-mysqli/master/db.php [10499/10499] -> "/tmp/wordpress//wp-content/db.php" [1] |
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
// theme code | |
$contestants = apply_filters('contestants', 'name'); | |
if ( is_array( $contestants ) ) { | |
foreach($contestants as $contestant){ | |
echo "hello " . $contestant . '<br>'; | |
} | |
} elseif ( is_string($contestants)){ |
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
$user = $this->factory->user->create_and_get( array( | |
'role' => 'administrator' | |
) ); | |
wp_set_current_user( $user->ID ); |
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 | |
if ( ! term_exists( 'free-flow', 'category' ) ) { | |
wp_insert_term( 'Free Flow', 'category', | |
array( | |
'description'=> 'Give extra left-right padding to the text block', | |
'slug' => 'free-flow', | |
) | |
); | |
} |
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
add_action( 'save_post', function(){ | |
wp_schedule_single_event( time(), 'action_to_run' ); | |
}); | |
add_action( 'action_to_run', 'function_to_run' ); | |
function function_to_run(){ | |
//asynchronous code to run! | |
} |
OlderNewer