Build custom permalinks tags
-
Hi, is it possible to build custom permalink tags and use them ?
Example :
Currently I have the current permalink for my single post :
…/%year%/%monthnum%/%category%/%postname%/
giving
…/2009/11/dogs/wondeful-shihuahua/Hi would like to
ADD A CUSTOM PERMALINK TAG defined with a function.
Let’s say the tag name would be “action”The permalink would be
…/%year%/%monthnum%/%action%/%category%/%postname%/
And the %action% value would be build with a function that checks something.
It that case, I would like action to be “sell” if the single post contains the “sell” tag, and the action to be “buy” if the single posts contains the “buy” tag. Else, nothing.
Something like
function get_permalink_action_tag():
global $post:$post_tags = wp_get_post_tags($post->ID);
if ($post_tags) {
foreach($post_tags as $tag) {
if (($tag==’sell’) || ($tag==’buy’))
return $tag;
}
}Is it possible ?
Thanks !
- The topic ‘Build custom permalinks tags’ is closed to new replies.