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 | |
/* | |
Plugin Name: WP Custom Shortlinks | |
Plugin URI: http://pmg.co/ | |
Description: Customizes the default WordPress Shortlinks | |
Version: n/a | |
Author: Christopher Davis | |
Author URI: http://pmg.co/people/chris | |
*/ |
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 | |
/** | |
* WordPress function for redirecting users on login based on user role | |
*/ | |
function my_login_redirect( $url, $request, $user ){ | |
if( $user && is_object( $user ) && is_a( $user, 'WP_User' ) ) { | |
if( $user->has_cap( 'administrator' ) ) { | |
$url = admin_url(); | |
} else { |
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
// This gist is now maintained on github at https://github.com/luetkemj/wp-query-ref | |
<?php | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.github.io | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query#Parameters | |
* Source: https://core.trac.wordpress.org/browser/tags/4.9.4/src/wp-includes/query.php | |
*/ |
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', 'custom_init_function' ); | |
function custom_init_function() { | |
global $pagenow; | |
if( ! is_user_logged_in() && 'wp-login.php' == $pagenow ) { | |
wp_redirect( home_url() ); // redirect URL | |
exit(); |
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 | |
/** | |
* WordPress Query Comprehensive Reference | |
* Compiled by luetkemj - luetkemj.com | |
* | |
* CODEX: http://codex.wordpress.org/Class_Reference/WP_Query | |
* Source: http://core.trac.wordpress.org/browser/tags/3.3.1/wp-includes/query.php | |
*/ | |
$args = 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 | |
/* | |
Plugin Name: Startpage Text Widget | |
Plugin URI: http://yap.nu/ | |
Description: Custom Description Text on startpage | |
Author: Han Lin Yap | |
Version: 1 (2012-10-08) | |
Author URI: http://yap.nu/ | |
*/ |
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( 'manage_edit-category_columns', 'we_categoriesColumnsHeader' ); | |
add_filter( 'manage_category_custom_column', 'we_categoriesColumnsRow', 10, 3 ); | |
/** | |
* Add Category ID column in admin | |
* | |
*/ | |
function we_categoriesColumnsHeader($columns) { | |
$columns['catID'] = __('ID'); | |
return $columns; | |
} |
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
/** | |
* Wordpress has a known bug with the posts_per_page value and overriding it using | |
* query_posts. The result is that although the number of allowed posts_per_page | |
* is abided by on the first page, subsequent pages give a 404 error and act as if | |
* there are no more custom post type posts to show and thus gives a 404 error. | |
* | |
* This fix is a nicer alternative to setting the blog pages show at most value in the | |
* WP Admin reading options screen to a low value like 1. | |
* | |
*/ |
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 | |
/* | |
The code below hides the admin menu items for all users that don't have the 'manage_sites' capability. | |
On multisite that would mean only Super Admins can look at those menu items | |
This script only removes the menu items so users can still look at the page if they know the path, but it de-clutters the admin | |
*/ | |
global $current_user; | |
if ( !current_user_can('manage_sites') ) { |
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', 'my_custom_page_word' ); | |
function my_custom_page_word() { | |
global $wp_rewrite; // Get the global wordpress rewrite-rules/settings | |
// Change the base pagination property which sets the wordpress pagination slug. | |
$wp_rewrite->pagination_base = "new-slug"; //where new-slug is the slug you want to use ;) | |
} |
OlderNewer