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 |
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
// Naturally, this is relative to each theme, | |
// you're going to have to hunt to figure out | |
// what the items are called in your functions.php | |
// of parent theme or framework code | |
// theme prefix = most likely your theme folder name | |
// Read these threads for context... | |
// http://wordpress.org/support/topic/overriding-twentyeleven-theme-optionsphp | |
// http://stackoverflow.com/questions/8994887/how-to-remove-wordpress-theme-options-from-child-theme | |
// http://codex.wordpress.org/Function_Reference/remove_submenu_page |
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
//How to edit a user profile on the front end? | |
//http://wordpress.stackexchange.com/questions/9775/how-to-edit-a-user-profile-on-the-front-end | |
//Forcing nickname as display_name in custom edit profile template | |
//http://wordpress.stackexchange.com/questions/35403/forcing-nickname-as-display-name-in-custom-edit-profile-template | |
/////// | |
<?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
$(function() { | |
// create a <div> to hold the overlay styles ... | |
$("body").append("<div id='overlay'></div>"); | |
// get the height of the document ... | |
var docHeight = $(document).height(); | |
// add some styling to the overlay. | |
$("#overlay") |
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( 'smilies_src', 'cor_smilies_src', 1, 10 ); | |
/** | |
* Smilies | |
* | |
* @param unknown_type $img_src | |
* @param unknown_type $img | |
* @param unknown_type $siteurl | |
* @return string | |
*/ |
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( 'gettext', 'een_excerpt_meta', 10, 2 ); | |
/** | |
* Rename the excerpt label and description. | |
* | |
* @since 0.1.0 | |
* | |
* @param type $translation | |
* @param type $original | |
* |
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_action( 'wp_head', 'cor_meta_desc_wp_head' ); | |
/** | |
* Excerpt as meta description. | |
* | |
* Echos `the_excerpt` only if one is set. | |
* | |
* @since 0.1.0 | |
*/ | |
function cor_meta_desc_wp_head() { |
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
//---------------------------------------------- | |
// Register Error if ID code does not match. | |
//---------------------------------------------- | |
function myplugin_check_fields($errors, $sanitized_user_login, $user_email) { | |
$mystring = $user_email; | |
$findme = '.edu'; | |
$pos = strpos($mystring, $findme); |
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 Post On New User Registration and Assign to User Registration | |
// ----------------------------------------------------------------- | |
add_action( 'user_register', 'gamma_new_user_post' ); | |
/** | |
* Add a new post when user registers. | |
*/ | |
function gamma_new_user_post( $user_id ) { |