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: Publish to Network | |
| * Plugin URI: https://gist.github.com/brasofilo/7036415 | |
| * Description: Meta box that allows publishing a post to another site of the network | |
| * Version: 1.0 | |
| * Author: Rodolfo Buaiz | |
| * Author URI: http://wordpress.stackexchange.com/users/12615/brasofilo | |
| * Text Domain: sepw | |
| * Domain Path: /languages |
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: Q and A | |
| Description: Create, categorize, and reorder FAQs and insert them into a page with a shortcode. | |
| Author: Raygun | |
| Author URI: http://madebyraygun.com | |
| Plugin URI: http://wordpress.org/extend/plugins/q-and-a/ | |
| Version: 0.2.8 | |
| */ |
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 | |
| /* lookforbadguys.php 2011-09-27 | |
| Copyright (C)2011 Karen Chun, Steven Whitney. | |
| Initially published by http://25yearsofprogramming.com. | |
| This program is free software; you can redistribute it and/or | |
| modify it under the terms of the GNU General Public License (GPL) | |
| Version 3 as published by the Free Software Foundation. | |
| This program is distributed in the hope that it will be useful, | |
| but WITHOUT ANY WARRANTY; without even the implied warranty of |
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 installation file | |
| * | |
| * This file customizes the initial setup of WordPress to suit my typical development needs | |
| * | |
| * Inspired by: | |
| * http://frn.gd/HgPnxP (WordPress Stack Exchange Entry) | |
| * http://frn.gd/HbIZpC (WordPress Basic Settings Plugin) | |
| * http://frn.gd/GVnGLt (Automating WordPress Customization) |
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: | |
| Plugin URI: | |
| Version: | |
| Description: | |
| Author: | |
| Author URI: | |
| Text Domain: | |
| Domain Path: |
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 to plugin init function | |
| add_filter('post_type_link', function ($permalink, $post_id, $leavename) { | |
| $post = get_post($post_id); | |
| $rewritecode = array( | |
| $leavename? '' : '%cursos%', | |
| '%category%', | |
| ); |
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 | |
| $role = 'subscriber'; | |
| if ( false === ( $userids = get_transient( "monthly_userids.{$role}" ) ) ) { // If the transient isn't set do it! | |
| global $wpdb; | |
| $start_date = date('Y-m-d H:i:s', strtotime('first day of this month')); | |
| $end_date = date('Y-m-d H:i:s', strtotime('first day of next month')); | |
| $userids = $wpdb->get_col( $wpdb->prepare( "SELECT SQL_CALC_FOUND_ROWS `user`.`ID` as `ID` FROM `{$wpdb->users}` AS `user`, `{$wpdb->usermeta}` AS `meta` WHERE 1=1 AND (`meta`.`user_id` = `user`.`ID` AND `meta`.`meta_key` = 'em_capabilities' AND `meta`.`meta_value` LIKE '%s') AND `user`.`user_registered` BETWEEN '%s' AND '%s' GROUP BY `user`.`ID`;", "%{$role}%", $start_date, $end_date ) ); | |
| set_transient( "monthly_userids.{$role}", $userids, 60*60*12 ); |
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( 'user_has_cap', function($all, $caps, $args, $user){ | |
| if (!in_array('contributor', $user->roles)) | |
| return $all; | |
| $posts = get_posts(array( | |
| 'post_type' => 'post', | |
| 'post_status' => 'publish', | |
| 'posts_per_page' => 1, | |
| 'author' => $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 | |
| // Exemplo 1 | |
| // Filtra a edição de posts da categoria 6 permitida apenas para os usuários 5 e 9 | |
| add_filter( 'user_has_cap', function( $allcaps, $caps, $args, $user ){ | |
| if ( in_array($args[0], array( 'edit_post' ) ) ) | |
| return $allcaps; | |
| // Para `edit_post` será passado um argumento com o ID do post que desejamos verificar | |
| if ( !isset( $args[2] ) || $args[2] == 0 || !is_numeric($args[2]) ) | |
| return $allcaps; |
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
| # WORDPRESS Live Preview | |
| This wrapper allows you to maintain a HTML holding page whislt seetting up a preview of a live WP site. | |
| This is handy if you tend to work locally and don't intend to set up a remote test environment. | |
| ## Usage | |
| http://www.yourwebsite.com?preview=allow | |
| http://www.yourwebsite.com?preview=end |