I have a CPT called 'projects', which display images with their titles.
I have a page to display the CPT's called 'single-projects.php'.

Is there a way through using templates and/or functions, to display the slugs like this:

  • themename/projects/project/
    This is so I can show all the CPT's in that project list on the single-project page.

instead of

  • themename/projects/slug-of-post
    This doesn't make sense to have each unique post slug if I am just showing one page for all CPT's in that list. I tried the rewrite argument, but I only want to change the slug-of-post.

I know I can change the slug for each CPT in their dashboard, but I want to do it via the back-end.

In my front-page I tried to use echo site_url('/single-project') for the image links but that doesn't work, am I doing it incorrectly?

  • I don't really get the question. Are you showing your posts on the single post pages; they're supposed to show just one post. And are you aware that you can enable archives for the post type, with custom URL like example.com/my-archive? And you can use the archive-<post type>.php template to customize the archive display? – Sally CJ Oct 16 at 15:29
  • I did initially have a single-page for my cpt's, but I changed it to a page template instead, so i can show all projects in a specific group, and the url will just be 'sitename/project/', which is what I wanted. I also have set has-archive for my cpt, to show every project group I create too. I am just learning at the moment too. – Krys Oct 18 at 7:59
  • So, do you still need help with the slug in question? If so, can you clarify the question - show what you've tried and the expected outcome? – Sally CJ Oct 19 at 7:24
  • My previous reply answers this question. Thanks. – Krys Oct 20 at 16:15

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.