About the custom-fields-permalink

WordPress > custom-fields-permalink

What’s this

  • This plugin enable to make a permalink from custom field’s value.

Requirements

  • WordPress 2.6

Installation

  1. Download archive from download page.
  2. Upload the Custom Fields Permalink plugin to your blog.
  3. Save a custom permalink structure again after this plugin is enabled.

License

MIT License

Custom permalink tags

  • %cfp_a_customfield_name%
  • %cfp_a_customfield_name_or_page_id%
  • %cfp_a_customfield_name_or_pagename%
    • “a_customfield_name” can be replaced with an arbitrary field name.

Examples

When a specification is as follows.
 - /%cfp_a_customfield_name%

 a entry has custom fields named "a_customfield_name":
  => /a_value_of_customfield (a value of "a_customfield_name")

 a entry has not custom fields named "a_customfield_name":
  => error!


When a specification is as follows.
 - /%cfp_a_customfield_name_or_page_id%

 a entry has custom fields named "a_customfield_name":
  => /a_value_of_customfield (a value of "a_customfield_name")

 a entry has not custom fields named "a_customfield_name":
  => /1 (page_id)


When a specification is as follows
 - /%cfp_a_customfield_name_or_pagename%

 a entry has custom fields named "a_customfield_name":
  => /a_value_of_customfield (a value of "a_customfield_name")

 a entry has not custom fields named "a_customfield_name":
  => /as_page_title (pagename)

13 Responses to “About the custom-fields-permalink”

  1. KUHM Says:

    Hello.

    I tried to install your plugin, but i don’t help me.

    My problem :

    I put custom fields in the title of the post, but the permalink is automaticaly created with the content of the title, and the content of the custom fields are not taken in the permalink.

    How to have permalink taking the content of the fields of the title custom fields, and not the name of the fields? (it’s complicated to explain, i hope i’m understandable)

    Thank you
    Cyril

  2. KUHM Says:

    Okay i got it

    For one custom field, it’s very nice :D

    But is it possible to have more custom fields in the permalink?

    And more, is it possible to have more custom fields and some text in the permalinks

    Example :

    I want to have : http://www.website.com/category/the-name-is-car

    The text “the-name-is” will be on every permalink
    The text “car” is a custom field

    So what i want to have can be represented :

    http://www.website.com/category/a-text-custom-field

    What is the permalink to do it?

    I can’t find it

    /%category%/….or_pagename%

  3. kuhm cyril Says:

    Please don’t delete my comments :(

    I find your plugin awesome, bug my little bug causes me several headaches.

    Could you just tell me how to have that

    I want to have : http://www.website.com/category/the-name-is-car-and-tree

    The text “the-name-is” will be on every permalink
    The text “car” is a custom field
    The text “and” will be on every permalink
    The text “tree” is a custom field

    So what i want to have can be represented :

    http://www.website.com/category/a-text-custom-field-a-text-custom-field

    What is the permalink to do it?

    Thank you so much

  4. admin Says:

    Hello Cyril.

    I feel sorry that the answer was delayed very much.
    Please forgive the impoliteness.

    Let’s think for a moment here.

    When you have a entry like below.
    | field | value |
    ——————
    | vehicle| car |
    | plant | tree |
    You want to have : http://www.website.com/category/the-name-is-car-and-tree
    Is this correct?

    When you have a entry like below.
    – no `vehicle` field.
    – no `plant` field.
    What do you want to have?
    Or do all entries have these field?

    Thank you so much.

  5. kuhm cyril Says:

    Hey admin :D

    To start with, thank you for your answer!

    i had so much headaches that i was in a big black hole ^^

    you are right, some fields could be empty … so is it possible, if the field is empty, to show nothing ? (sorry i can’t find a good sentence to explain it.

    One example :

    | field | value |
    ——————
    | vehicle | car |
    | plant | tree |
    | person | | (nothing)

    title : http://www.website.com/category/the-name-is-%person%%vehicle%-and-%plant%

    i want to have : http://www.website.com/category/the-name-is-car-and-tree

    am i understandable?

    Thank you so much :D
    Cyril

  6. admin Says:

    Hello Cyril.

    Okey.
    It has understood considerably.

    But, this specification is a little difficult.
    > | field | value |
    > —————–
    > | vehicle | car |
    > | plant | tree |
    > | person | | (nothing)
    >
    > title : http://www.website.com/category/the-name-is-%person%%vehicle%-and-%plant%
    >
    > i want to have : http://www.website.com/category/the-name-is-car-and-tree

    Because it is indistinguishable in the following cases.
    URL: http://www.website.com/category/the-name-is-car-and-tree
    | field | value |
    —————–
    | vehicle | car |
    | plant | tree |
    | person | | (nothing)
    or
    | field | value |
    —————–
    | vehicle ||(nothing)
    | plant | tree |
    | person | car |
    or
    | field | value |
    —————–
    | vehicle | r |
    | plant | tree |
    | person | ca |

    In addition, it is indistinguishable in the following other cases.
    title : http://www.website.com/category/the-name-is-%person%-%vehicle%-%plant%
    URL: http://www.website.com/category/the-name-is-some-person-car-tree
    | field | value |
    —————–
    | vehicle | car |
    | plant | tree |
    | person | some-person |
    or
    | field | value |
    —————–
    | vehicle | person-car |
    | plant | tree |
    | person | some |

    Sorry, this multiple customfields problem is very difficult.

    Thank you.

  7. Cyril Says:

    Hello!

    Thank you for your answer.

    Unfortunately, like you say, it is very difficult.

    My goal is to create some easy backoffice for my ‘journalists’, and to have beautiful urls for search engines.

    one thing i thought (it can be a bad idea but who knows ^^) is:
    instead of having ‘nothing’, we have a special character ($, *, #, …) could it be done?

    Instead of giving you some beautiful exemple in a beautiful world, here is a title i would have to exploit :

    Pronostic {[ .Equipe_1 ]} – {[ .Equipe_2 ]} (Pronostic {[ .Sport ]}{[ .Type_de_rencontre ]} {[ .Pays_1 ]}{[ .Pays_2 ]} {[ .Ligue_Basket ]}{[ .Ligue_Football ]}{[ .Ligue_Handball ]}{[ .Ligue_Hockey ]}{[ .Ligue_Tennis ]}{[ .Ligue_Turf ]} {[ .Pronostiqueur ]}) – le {[ .Jour ]}/{[ .Mois ]}/{[ .Annee ]} à {[ .Heure ]}H{[ .Minutes ]}

    Pronostic = static text
    Equipe_1 = custom field : some sport team
    Equipe_2 = custom field : some sport team
    Sport = custom field : some sport
    Type_de_sport = custom field
    Pays_1 = custom field : a country
    Pays_2 = custom field : a country
    Ligue_Basket = custom field : a basket ball league
    Ligue_Football = custom field : a Football league
    Ligue_Handball = custom field : a Handball league
    Ligue_Hockey = custom field : a Hockey league
    Ligue_Tennis = custom field : a Tennis league
    Ligue_Tennis = custom field : a Tennis league
    Ligue_Turf = custom field : a horse league
    Pronostiqueur = custom field : the writer
    le = static text
    Jour = custom field : the day
    Mois = custom field : the month
    Annee = custom field : the year
    à = static text
    Heure = custom field : the hour
    Minutes = custom field : the minutes

    One more thing :

    i can do something in order to avoid empty custom fields.

    So with all this data (sorry for this big text)

    I know it’s hard, that’s why i ask to a pro, because i’m a noob :D
    Thank you for the time you spend for me :D

    Empty custom fields could be replaced by a special character?
    Empty custom fields could be deleted if we have no other solutions.

    To have multiple custom fields, we could separate the fields with a special character? Or other solution?

    Last but no least, what i’m doing now if it can help you :

    In the article title are custom fields
    I pre-publish the article, i copy the published title (so without custom fields but with the good content)
    I paste the good content in the permalink field of the article
    I save
    The permalink is fine

    Thank you in advance
    best regards
    Cyril

  8. KUHM Cyril Says:

    Do you have an idea? Or must i search on my own?
    Thanks

  9. KUHM Cyril Says:

    One other idea :

    Create (if is is possible) an custom field taking all other custom fields and put it in the permalink :

    exemple :

    Pronostic = static text
    Equipe_1 = custom field : some sport team
    Equipe_2 = custom field : some sport team
    Sport = custom field : some sport
    Type_de_sport = custom field

    Custom field permalink :
    Permalink = Pronostic-Equipe_1-Equipe_2-Sport-Type_de_sport

  10. C Serrano Says:

    Nice plugin, thanks.

  11. Chris Gray Says:

    Hi, thank you for a great plugin. The only thing it doesn’t do; if there are spaces in the name of the custom field (for example “golden slumbers”) it doesn’t know how to handle the space, and leaves it as a space. This might break pages, can you fix it so it uses dashes? WP uses them for the post title so it’ll make it act the same way. :)

  12. Ilona Says:

    Hello,

    thanks for very useful plug in.

    the problem i find is that if i use the plugin, pages don’t load and instead i only see the index page.

    is there something i do wrong.

    this is the structure i use:

    /%cfp_city_or_pagename%/%postname%-%post_id%

    many thanks.

  13. admin Says:

    I’m sorry to the user of custom-fields-permalink.

    This plugin is currently not supported. Thus, the comment on this archive will not accept.

    I feel sorry not to support it.

    many thanks.

Leave a Reply