Cool plugin. I stumped upon it when searching for a solution. It’s a long shot but I thought I would ask. Can I somehow use this plugin to embed a post slug throughout a post. I want to be able to populate areas of my article with the post’s slug name. This would save a lot of time! Thanks
]]>Your plugin makes my day and saves my ass ??
https://www.ads-software.com/plugins/add-url-slugs-as-body-classes/
]]>I would recommend refactoring the plugin to use the post slug $post->post_name
rather than picking apart the permalink structure. This method would also work on installs that do not use “pretty permalinks”.
You should also consider sanitizing the added classes with sanitize_html_class().
I also think it would be a good idea to prefix the value with the posttype for example to prevent un-intended results.
( ie: {$posttype}_{$post->post_name}
)
This kind of change would break selectors for people using the current implementation though so an option would be needed for backwards compat.
For example: A post/page with title “Hide” on a site using the popular twitter bootstrap framework would render the entire site invisible.
Cheers ??
https://www.ads-software.com/plugins/add-url-slugs-as-body-classes/
]]>Title says it all. That is, any url with ?q=some-search-query or anything else is being added to the body class.
https://www.ads-software.com/plugins/add-url-slugs-as-body-classes/
]]>Plugin does not work in Thesis because of how Thesis does things (not the plugin’s fault).
So I used the code from the plugin and used Thesis’ custom filter thesis_body_classes.
Thanks!
https://www.ads-software.com/extend/plugins/add-url-slugs-as-body-classes/
]]>