What is a “slug” in Django?
When I read Django code I often see in models what is called a “slug”. I am not quite sure what this is, but I do know it has something to do with URLs. How and when is this slug-thing supposed to be used?
When I read Django code I often see in models what is called a “slug”. I am not quite sure what this is, but I do know it has something to do with URLs. How and when is this slug-thing supposed to be used?
I have a string that I want to use as a filename, so I want to remove all characters that wouldn’t be allowed in filenames, using Python.
Alternate Question: How to change Permalink structure for CPT so that post name comes in the middle of URL instead of in the end eg. /a/%postname%/b/c
I’ve been fiddling with this all day, where I’m trying to change my search function from website.com/s?this%20is%20an%20example to website.com/tag/this-is-an-example to no avail.
Circumstances: I have a CPT called “designs” and a taxonomy related to it, called “project_category” so that I can assign a category to each design. I’m building the template for each ‘design’ and I need a shortcode that returns the assigned project category SLUG of the current design within the loop.
I currently have a function that checks to see if the page is a parent, and if so, do stuff. But I also want to check to see if the parent has a child page that has a certain slug.
I have a somewhat tricky situation. A company’s internal server, running some unknown software (means I have no access whatsoever), exports data to my http server via a custom API. This data gets stored in the same MySQL environment as WordPress. Just a different DB. Meaning DB1 has the WP data, DB2 holds the imported company data.
So I have a project I am currently working on, where I have a WordPress set to a permalink structure of /blog/%postname% for blog posts and pages are domain.com/page-slug/
I searched for something like single_cat_slug but I did not find something relevant. All I don’t know how to do it is to find the slug, not the name, of the currently opened category page. I do not know how to find the slug if I have the name.
I have a bunch of posts that contain images with urls that follow this pattern: