• Resolved tommy83

    (@tommy83)


    I need url like this:
    domain.de/customfield_value/title

    example:
    domain.de/120/happy-new-year
    and
    domain.de/120

    So the page can be opned via unique customfield value and unique customfield value id + title. Is it possible to have this with your plugin?

    I see your pro extension can do that by using %__fieldname%/%postname%
    But only domain domain.de/120/happy-new-year will show content.
    Domain domain.de/120/ will show error.

    I wrote you many times via your contact form on your website, but i do not get any feedback. I hope you can support me here. ??

Viewing 5 replies - 1 through 5 (of 5 total)
  • Plugin Author Maciej Bis

    (@mbis)

    Hi @tommy83,

    I answered on your email, maybe my response was marked as SPAM, as I included there a piece of code ??

    Here is the snippet:

    function pm_detect_deal_endpoints($parts) {
    	if(!empty($parts['uri'])) {
    		$parts['uri'] = preg_replace('/(.*)\/([\d]+)\/([^\/]+)$/', '$1/$2', $parts['uri']);
    	}
    
    	return $parts;
    }
    add_filter('permalink_manager_detect_uri', 'pm_detect_deal_endpoints');

    Basically, if you set your custom permalink to eg.:
    domain.de/deal/120

    Other versions with additional endpoints will also be detected, eg.:

    domain.de/deal/120/happy-new-year
    domain.de/deal/120/it-will-work-with-anything-here

    Best regards,
    Maciej

    Thread Starter tommy83

    (@tommy83)

    Hello Dear,

    thank you for your fast feedback.

    I entered this snippet to my functions.php:
    <?php

    function pm_detect_deal_endpoints($parts) {
    if(!empty($parts[‘uri’])) {
    $parts[‘uri’] = preg_replace(‘/(.*)\/([\d]+)\/([^\/]+)$/’, ‘$1/$2’, $parts[‘uri’]);
    }

    return $parts;
    }
    add_filter(‘permalink_manager_detect_uri’, ‘pm_detect_deal_endpoints’);

    I added this permalink to permalink manager pro:
    /deal/%__uri%/%postname%
    Customfield name in post is uri. Value is: 120

    This is correct?!
    I click on REGENERATE button.

    Now i openthe post and check url: domain.de/deal/120/title
    Also fine! But i get 404 not found error. ??

    • This reply was modified 5 years, 4 months ago by tommy83.
    Thread Starter tommy83

    (@tommy83)

    Update:
    1. When i enter ABC to custom field its working:
    domain.de/deal/abc/title -> working.

    2. When i enter short version also not working:
    domain.de/deal/abc/

    2. When i enter numeric value like 120 to custom field its not working:
    domain.de/deal/120/title

    3. Try short version of numeric version also not working:
    domain.de/deal/120/

    So only alphabetical values working in url. Short version also not working.

    • This reply was modified 5 years, 4 months ago by tommy83.
    Plugin Author Maciej Bis

    (@mbis)

    Hi @tommy83,

    please note that on this forum, I provide support only for free version of plugin. Also, the support for Permalink Manager Pro is available only for users who own a valid license key. If you need my further assistance, please contact me via email contact /at/ maciejbis.net

    Best regards,
    Maciej

    Thread Starter tommy83

    (@tommy83)

    Hello my friend,

    done. I have send you email now. Please check your email.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘routing by id and add title to url’ is closed to new replies.