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', 'change_author_permalinks' ); | |
function change_author_permalinks() | |
{ | |
global $wp_rewrite; | |
// On définit un nouveau tag pour les rôles des auteurs | |
add_rewrite_tag( '%author_level%', '([a-z0-9]+)' ); | |
// On modifie la structure url de base des pages d'un auteur par notre nouveau tag | |
$wp_rewrite->author_base = '%author_level%'; | |
// On met à jour les règles de ré-écriture | |
$wp_rewrite->flush_rules(); |
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 | |
//http://www.geekpress.fr/wordpress/tutoriel/modifier-url-profils-auteurs-role-619/ | |
add_action( 'init', 'change_author_permalinks' ); | |
function change_author_permalinks() | |
{ | |
global $wp_rewrite; | |
// On définit un nouveau tag pour les rôles des auteurs | |
add_rewrite_tag( '%author_level%', '([a-z0-9]+)' ); | |
// On modifie la structure url de base des pages d'un auteur par notre nouveau tag |
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 | |
//http://wordpress.stackexchange.com/questions/31418/how-to-change-author-base-without-front | |
function change_author_permalinks() { | |
global $wp_rewrite; | |
$wp_rewrite->author_base = 'connect/member'; | |
$wp_rewrite->author_structure = "/" . $wp_rewrite->author_base . '/%author%'; | |
add_rewrite_rule('connect/member/([^/]+)/?$', 'index.php?author_name=$matches[1]', 'top'); | |
} | |
add_action('init','change_author_permalinks'); |
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 | |
//http://w4dev.com/wp/change-wordpress-author-url-base/ | |
function my_custom_author_base(){ | |
$author_base = "profile" ; //Your desired author base. | |
global $wp_rewrite ; | |
$wp_rewrite->author_base = $author_base ; | |
$wp_rewrite->flush_rules() ; | |
} |
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 | |
//http://www.scottbressler.com/blog/2011/03/wordpress-archive-page-with-all-authors-and-all-posts/ | |
/** | |
* Template Name: All Author Archives | |
* Code: Scott Bressler (http://www.scottbressler.com/blog) | |
* Explanation: http://www.scottbressler.com/blog/2011/03/wordpress-archive-page-with-all-authors-and-all-posts | |
*/ | |
get_header(); ?> | |
<div id="container"> | |
<div id="content"> |
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: Breadcrumb Functions | |
Description: Functions for displaying breadcrumbs when working with hierarchical post types. Does nothing out-of-the-box, functions must be added to theme (directly or via hooks, your discretion). | |
Author: Kailey Lampert | |
Author URI: http://kaileylampert.com/ | |
*/ | |
/* | |
Basic: | |
echo get_breadcrumbs( $post ); |
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: [concept] Cross-CPT Parent/Child | |
//Description: Just a demo!. | |
add_action( 'init', 'kl_post_types'); | |
function kl_post_types() { | |
register_post_type( 'parent', array( | |
'label' => 'Parent', |
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
jQuery.fn.shake = function(intShakes, intDistance, intDuration) { | |
this.each(function() { | |
$(this).css({ | |
position: "relative" | |
}); | |
for (var x = 1; x <= intShakes; x++) { | |
$(this).animate({ | |
left: (intDistance * -1) | |
}, (((intDuration / intShakes) / 4))).animate({ | |
left: intDistance |
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 | |
/* | |
Template Name: All Authors' Page | |
Description: Get all the WordPress user's meta_information sort by the latest post action. (Which had at least 1 post published.) | |
*/ | |
?> | |
<?php get_header(); ?> | |
<ul> | |
<?php | |
// offset -> post number | -1 means all the posts. |
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 | |
/* Mini Gavatar Cache */ | |
/* 注:该程序中部分代码是WordPress所用,小幅修改即可复用。 */ | |
function my_avatar( $email, $size = '50', $default = '', $alt = false ) { | |
$alt = (false === $alt) ? '' : esc_attr( $alt ); | |
$f = md5( strtolower( $email ) ); | |
$w = home_url(); //$w = get_bloginfo('url'); | |
$a = $w. '/avatar/'. $f . '.jpg'; | |
$e = preg_replace('/wordpress\//', '', ABSPATH) . 'avatar/' . $f . '.jpg'; | |
$t = 604800; //设定7天, 单位:秒 |
OlderNewer