Forum Replies Created

Viewing 7 replies - 1 through 7 (of 7 total)
  • Forum: Fixing WordPress
    In reply to: Weird issue
    Thread Starter codelizard

    (@codelizard)

    It is neither a custom post type nor taxonomy. I dont have any special rewrite rules in the .htaccess.

    I add a rewrite rule for this: ‘vendors(/?.*)?’ just so wordpress doesnt send me to the 404 page. Then, I use a filter for “template_include” where I check the URL. If the first section of the url is “vendors”, I then send them to my Vendors template.

    All of my work then happens in the vendors template.

    The issue seems to be if the url ends in “/”, and is not a direct hit on an existing url, it is doing a keyword search on the last parm in the string and redirecting to that article.

    By changing the way I do my URLS to end in “.html”, this no longer happens. I would still like an explanation, but for the moment this is working. I even just got done creating all of the 301 redirects for the 200+ urls I just changed.

    Forum: Fixing WordPress
    In reply to: Weird issue
    Thread Starter codelizard

    (@codelizard)

    Ok, I finally figured out that this is a fruitless exercise. I tried changing the number of parms, so it wasnt the third parm and no matter what I did, it always ended up the same. So, instead of my URLS doing this:

    http://www.guitarnewsdaily.com/vendors/amps/yamaha/

    They now do this:

    http://www.guitarnewsdaily.com/vendors/amps/yamaha.html

    And they work great. I still wish I knew WHY it was doing the above, but I’ve now worked around it.

    Forum: Fixing WordPress
    In reply to: Weird issue
    Thread Starter codelizard

    (@codelizard)

    More information:

    I’ve been tracing this, and this is whats happening:

    I have an add_filter call for “template_include”, which is used to find which template I am using. This is how I send everything starting with “/vendors” to my own template for processing.

    Unfortunately, the URL is being redirected to the new one before the template_include call is made. Hence, skipping my vendor section.

    Still looking for help!

    Thread Starter codelizard

    (@codelizard)

    oops, forgot to mark it resolved.

    Thread Starter codelizard

    (@codelizard)

    Ok got this. The solution was to use the rewrite api, as mentioned above, to look for the pattern /vendors/, letting it know that it was a valid URL. Coupled with my existing template override, this is what I needed.

    On a side note, in regards to the custom post type, this data is actually in a completely third-party system utilizing its own database. Doing the code this way, I’m able to leverage the data from the existing system which handles all of the adds, updates, deletes, etc without needing to write a bridge to duplicate the data into the wordpress db and keep them in sync. This is a better solution for our situation…

    Thread Starter codelizard

    (@codelizard)

    So, a thought. Maybe I do have a “page” for each vendor. I could write a batch job to run through the DB and create a page for each entry in my DB, and then write a piece of code to do all of the DB stuff each time I add/edit/delete a record in our main database.

    Besides that, the only other thing I could think of was trying to put all of our data into wordpress as a custom post type, but with all of my requirements I’m sure it would work either.

    Nothing from the experts on this? Even a gentle kick in the right direction?

    Thread Starter codelizard

    (@codelizard)

    Ok, I believe I solved the issue. It’s odd, but here is what I did.

    Back in version, oh, 2.something, we changed our permalinks to “topics” instead of “category”. Well, the “topics” links are the one that werent working.

    So, after rebuilding the database and all kinds of things, i finally decided to go into the permalinks settings and just re-click “SAVE”. It already knew to use “topics” as my category base, all i had to do was “SAVE CHANGES”.

    And guess what? It all started working. The category links now work.

    Go figure.

    Figured I would share this for anyone else who had the same issue.

Viewing 7 replies - 1 through 7 (of 7 total)