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 | |
require( '../wp-load.php' ); | |
require_once( 'simple_html_dom.php' ); | |
$result = wp_remote_get( 'http://lloc.de/' ); | |
if ( !is_wp_error( $result ) ) { | |
$html = str_get_html( $result['body'] ); | |
foreach ( $html->find( 'a' ) as $a ) { | |
if ( isset( $a->rel ) && false !== strpos( 'nofollow', strtolower( $a->rel ) ) ) |
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 MY_Widget_Links extends WP_Widget_Links { | |
function widget( $args, $instance ) { | |
if ( !is_front_page() && !is_home() ) | |
parent::widget( $args, $instance ); | |
} | |
} |
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 | |
define( 'MYPLUGIN_MIN_PHP', '5.2' ); | |
define( 'MYPLUGIN_MIN_WP', '2.8' ); | |
function myplugin_activate () { | |
$error = ''; | |
$phpversion = phpversion(); | |
if ( version_compare( MYPLUGIN_MIN_PHP, $phpversion, '>' ) ) | |
$error .= sprintf( "Minimum PHP version required is %s, not %s.\n", MYPLUGIN_MIN_PHP, $phpversion ); |
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 | |
remove_filter( 'the_content', 'wpautop' ); | |
remove_filter( 'the_excerpt', 'wpautop' ); |
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 simple_cpt_init() { | |
register_post_type( 'simple' ); | |
} | |
add_action( 'init', 'simple_cpt_init' ); |
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 | |
define( 'PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); | |
function my_plugin_action_links( $actions, $plugin_file, $plugin_data, $context ) { | |
if ( PLUGIN_BASENAME == $plugin_file ) | |
$actions[] = '<a href="#">Test: plugin_action_links</a>'; | |
return $actions; | |
} | |
add_filter( 'plugin_action_links', 'my_plugin_action_links', 10, 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 | |
namespace WPSE\realloc; | |
if ( is_admin() ) { | |
function remove_quick_edit( $actions, $post ) { | |
if( ! current_user_can( 'manage_options' ) ) | |
unset( $actions['inline hide-if-no-js'] ); | |
return $actions; | |
} |
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 | |
namespace WPSE\realloc; | |
function my_site_menu( $field ) { | |
$field['choices'] = array(); | |
$menus = get_terms( 'nav_menu', array( 'hide_empty' => true ) ); | |
if ( is_array( $menus ) ) { | |
foreach( $menus as $menu ) { | |
$field['choices'][$menu->name] = $menu->name; |
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_enqueue_scripts() { | |
wp_enqueue_style( 'my-style', get_stylesheet_uri() ); | |
wp_enqueue_script( | |
'my-script', | |
get_template_directory_uri() . '/js/script.js', | |
array( 'jquery' ), | |
false, | |
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
jQuery(document).ready(function($) { | |
$('#message-box').html( | |
objectL10n.str_hello_world | |
); | |
}); |