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( 'PLUGIN_BASENAME', plugin_basename( __FILE__ ) ); | |
| function my_plugin_row_meta( $plugin_meta, $plugin_file, $plugin_data, $status ) { | |
| if ( PLUGIN_BASENAME == $plugin_file ) | |
| $plugin_meta[] = '<a href="#">Test: plugin_row_meta</a>'; | |
| return $plugin_meta; | |
| } | |
| add_filter( 'plugin_row_meta', 'my_plugin_row_meta', 10, 4 ); |
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 simple_cpt_init() { | |
| register_post_type( 'simple' ); | |
| } | |
| add_action( 'init', 'simple_cpt_init' ); |
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 | |
| remove_filter( 'the_content', 'wpautop' ); | |
| remove_filter( 'the_excerpt', 'wpautop' ); |
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( '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 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_shortcode( 'countryinfo', function ( $atts ) { | |
| $params = shortcode_atts( [ 'lang' => 'de', 'country' => 'DE', 'username' => 'USERNAME' ], $atts ); | |
| $url = add_query_arg( $params, 'http://ws.geonames.org/countryInfo' ); | |
| $result = wp_remote_get( $url ); | |
| if ( is_wp_error( $result ) ) { | |
| return $result->get_error_message(); | |
| } |
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://ws.geonames.org/search?q=london&maxRows=10&username=USERNAME'; | |
| $xml = simplexml_load_file( $url ); | |
| echo "Ausgabe des SimpleXML-Objects:\n"; | |
| print_r( $xml ); | |
| $json = file_get_contents( $url . '&type=json' ); |
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 | |
| 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 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 | |
| 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 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 | |
| $name = 'scg_' . md5( $href ); | |
| if ( false === ( $value = get_transient( $name ) ) ) { | |
| $response = wp_remote_get( $href ); | |
| if ( !is_wp_error( $response ) ) { | |
| $value = trim( $response['body'] ); | |
| if ( !empty( $value ) ) | |
| set_transient( $name, $value, 86400 ); | |
| } |