• Resolved Damien Smith

    (@stickso)


    Hi Greg, I used the details here to change the advert slugs and it all worked great:
    https://www.ads-software.com/support/topic/how-to-change-url-of-adverts-category/

    Then I installed the Custom Fields add-on and after that, clicking on an advert would just send me to the homepage.

    If I disable the Custom Fields plugin it’s OK and I can see the advert. If I leave the Custom Fields plugin enabled and remove the code for the custom slugs (in functions.php) it’s OK, but not both together.

    Also, my theme has breadcrumbs and the breadcrumb says ‘Classified’ which I also want to change but not sure how.

    Thanks!

Viewing 6 replies - 1 through 6 (of 6 total)
  • Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    hmm the Custom Fields add-on does not interfere with the slugs in any way so, i am not really sure what might be happening.

    After installing Custom Fields have you tried going to wp-admin / Settings / Permalinks panel and clicking “Save Changes” button? This would reset the permalinks.

    Can you also let me know what code have you used to change the permalinks?

    Regarding the Breadcrumbs in the theme it would be best to ask the theme author about, if you are looking to just change the word “Classifieds” to something else, then most likely the code below will do that but it will also change the word Classifieds for example in wp-admin menu

    
    add_filter( "adverts_post_type", "my_adverts_post_type", 10, 2 );
    function my_adverts_post_type( $args, $type ) {
        if( $type != "advert" ) {
            return $args; 
        }
        $args["labels"]["name"] = "Ads";
        $args["labels"]["singular_name"] = "Ads";
        return $args;
    }
    
    Thread Starter Damien Smith

    (@stickso)

    Hi Greg,

    That code has changed the breadcrumb – thanks for that.

    I added the snippet for the custom slugs again to my functions.php. I copied everything from add_action down from here https://github.com/simpliko/wpadverts-snippets/blob/master/custom-slugs/custom-slugs.php

    Custom Fields is already active so I then went into wp-admin/settings/permalinks and clicked save changes. When I mouse over an ad the URL has updated to the custom slug, but clicking on it sends me to the homepage. However, the categories work fine with the new slug.

    Then I disabled the Custom Fields plugin and the ads display fine with the new slug.

    Thanks.

    Plugin Author Greg Winiarski

    (@gwin)

    Hi,
    hmmm there are two things you might want to try:

    1. use some other slug for Ad details page, to do that change the line

    
    $args["rewrite"]["slug"] = "classified";
    

    to for example

    
    $args["rewrite"]["slug"] = "my-classified";
    

    2. try using some third party plugin to modify the permalinks, for example https://www.ads-software.com/plugins/custom-post-type-permalinks/

    BTW. Any chance you have a page with [adverts_list] at https://example.com/classifieds/ and the links to individual Ad pages look like https://example.com/classifieds/test-ad/? If so then you would need to change the “classifieds” slug in the first link to something else as in this form it would conflict with the custom post type prefix.

    Last thing that i can think of is that if you have a plugin related to redirects, you can try disabling it and see if it helps.

    Thread Starter Damien Smith

    (@stickso)

    Thanks Greg – I’ll try those. Will let you know.

    Thread Starter Damien Smith

    (@stickso)

    I checked that there were no other pages with the same slug and also tried a new slug for the ad details page but no change.

    Thanks for your help with this but I’ll leave it – must be something weird with my setup.

    Plugin Author Greg Winiarski

    (@gwin)

    Ok, i will dig deeper into this tomorrow and will check if i can somehow replicate this issue and fix it, i will post here if i find something.

Viewing 6 replies - 1 through 6 (of 6 total)
  • The topic ‘Clash between custom slugs and custom fields add-on’ is closed to new replies.