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 | |
| /* | |
| * http://necenzurat.net/2010/05/26/clean-up-and-url-like-wordpress-does.dev | |
| * Create a slug for friendly URL's a-la wordpress | |
| */ | |
| function clean_url($str) { | |
| $clean = preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $str); | |
| $clean = strtolower(trim($clean, '-')); | |
| $clean = preg_replace("/[\/_|+ -]+/", '-', $clean); |
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 | |
| // Custom WordPress Admin Color Scheme | |
| function admin_css() { | |
| wp_enqueue_style( 'admin_css', get_template_directory_uri() . '/css/admin.css' ); | |
| } | |
| add_action('admin_print_styles', 'admin_css' ); | |
| ?> |
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 to functions.php in your WordPress theme | |
| add_filter('upload_mimes', 'm6z_upload_mimes'); | |
| function m6z_upload_mimes($mimes = array()) | |
| { | |
| $mimes['svg'] = 'image/svg+xml'; | |
| return $mimes; | |
| } | |
| ?> |
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 Lightbox to Wordpress Gallery | |
| add_filter( 'wp_get_attachment_link', 'm6z_addlightbox2gal'); | |
| function m6z_addlightbox2gal ($content) { | |
| $content = preg_replace("/<a/","<a rel=\"prettyPhoto[slides]\" class=\"preloader\"",$content,1); | |
| return $content; | |
| } ?> |
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 | |
| /* =BEGIN: Add Class to first Paragraph in WordPress the_content(); | |
| Source: http://webdevbits.com/wordpress/add-class-to-first-paragraph-in-wordpress-the_content/ | |
| ---------------------------------------------------------------------------------------------------- */ | |
| function first_paragraph($content){ | |
| // Testing to see if the content is a Page or Custom Post Type of school, if so, display the text normally (without the class = intro). | |
| if ( is_page() || ('school' == get_post_type() ) ) { | |
| return preg_replace('/<p([^>]+)?>/', '<p$1>', $content, 1); | |
| } else { | |
| return preg_replace('/<p([^>]+)?>/', '<p$1 class="intro">', $content, 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
| <?php | |
| /** | |
| * Carrega a API do WordPress | |
| */ | |
| define('WP_USE_THEMES', false); // Não utiliza nenhum tema | |
| require('./wordpress/wp-load.php'); | |
| query_posts('showposts=1'); | |
| while (have_posts()): the_post(); |
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 unhide_kitchensink( $args ) { | |
| $args['wordpress_adv_hidden'] = false; | |
| return $args; | |
| } | |
| add_filter( 'tiny_mce_before_init', 'unhide_kitchensink' ); | |
| ?> |
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 | |
| $json ='{"id":1,"name":"foo","interest":["wordpress","php"]} '; | |
| $obj=json_decode($json); | |
| echo $obj->interest[1]; //prints php | |
| ?> |
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 all_tinymce( $args ) { | |
| $args['wordpress_adv_hidden'] = false; | |
| return $args; | |
| } | |
| add_filter( 'tiny_mce_before_init', 'all_tinymce' ); |
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
| // Remove unwanted dashboard metaboxes | |
| add_action('wp_dashboard_setup', 'my_custom_dashboard_widgets'); | |
| function my_custom_dashboard_widgets() { | |
| global $wp_meta_boxes; | |
| //QuickPress | |
| unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_quick_press']); | |
| //Wordpress Development Blog Feed | |
| unset($wp_meta_boxes['dashboard']['side']['core']['dashboard_primary']); |
NewerOlder