Support » Plugins and Hacks » Custom permalink tag

  • DaveHope

    (@davehope)


    Hello all,

    I’ve taken a look over tha avaliable permalink tags (http://codex.wordpress.org/Using_Permalinks) and i’d like to add one (%epoch% – to reflect the unix timestamp a page was created on) to match my current blog software.

    I’ve taken a look through options-permalink.php, link-template.php and rewrite.php which seem to be where the changes would need to be made.

    There are a number of things i’d like to check first tho:

    1: Is there a better way for me to implement my changes than altering those files?

    2: If I do alter them, is it worth me making a patch and submitting it?

    3: Is there anywhere else that i’be missed that I’d need to add the change?

    Thanks guys.

    Dave

Viewing 3 replies - 1 through 3 (of 3 total)
  • Moderator Samuel Wood (Otto)

    (@otto42)

    Is there a better way for me to implement my changes than altering those files?

    Yes. You can use a filter in a plugin.
    http://codex.wordpress.org/Filters

    Specifically, you need to use the ‘post_link’ filter for the get_permalink() function.

    You’ll also need to modify the rewrite rules to allow your permalink to work. You’ll probably use the add_rewrite_tag() function for this. I’m not too familiar with this code, so can’t offer much help here.

    DaveHope

    (@davehope)

    Had a quiet evening, so have created a patch and submitted it to the wp-hackers mailing list.

    DaveHope

    (@davehope)

    Sorry Otto 42. Didn’t notice your response. Didn’t refresh the window between starting the thread and posting my follow up. Whoops.

    Thanks for your reply, will see what is said on the ML and probably end up using a Filter and ditchign my alteration.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Custom permalink tag’ is closed to new replies.