Community Forums › Forums › Archived Forums › Design Tips and Tricks › How To Duplicate Minimum Portfolio for Custom Post Archive
Tagged: archive, Custom post, minimum
- This topic has 10 replies, 2 voices, and was last updated 10 years, 9 months ago by rfmeier.
-
AuthorPosts
-
June 6, 2013 at 6:47 pm #44452eliserochelleMember
Hi,
I've created a custom post type and I'd like to have the archive page display like the portfolio page rather than like the blog page.
How do I do this?
Do I just copy and rename the archive-portfolio.php file? What do I need to put in the functions.php to link it up with the custom post type?
Oh and is it simple enough to display an excerpt under the image?
Thanks so much,
Elise
http://soulstories.net.au
June 6, 2013 at 8:31 pm #44466rfmeierMemberHello,
You are correct about the copy/rename of archive-yourcustomposttype.php file. WordPress will automatically know to look for that file. If the file is not there, WordPress will use the archive.php file. If that is not there, it will look for index.php.
Hope this clears it up.
June 7, 2013 at 2:16 am #44479eliserochelleMemberThanks for the quick response rfmeier.
I've duplicated the file and name it archive-(custom post slug).php however it's not using it.
I'm using the Custom Post Type UI by WebDevStudios for the custom post type, do I need to change anything in that file? I can't see anything that looks like needs changing ...
I've tried to find an answer on the plugin site too with no luck
June 7, 2013 at 5:15 am #44491rfmeierMemberJune 7, 2013 at 4:28 pm #44654eliserochelleMemberHi,
it's wedding-event-hire
should it perhaps only be one word?
thanks,
Elise
June 7, 2013 at 5:44 pm #44660eliserochelleMemberOk so I did an experiment and changed the slug for the custom post type to 'hire' and uploaded a copy of the portfolio file and named it 'archive-hire.php'
When I type in soulstories.net.au/hire it's an error 404
When I type in the old slug soulstories.net.au/wedding-event-hire the page works (weird?) and is in the portfolio format (except it's 1 column when it should be 3). When I type on the posts from this page it produced a 404 as it's using the new slug e.g. http://soulstories.net.au/hire/vintage-books
When I change the url to use the old slug it works http://soulstories.net.au/wedding-event-hire/vintage-books
I'm officially totally confused ... I've changed the slug to 1 word which has now made the porfolio archive page work however, it works only using the old slug ... the archive page is linking the posts using the new slug which doesn't work as the old slug works.
I now have both archive files uploaded (archive-hire.php and archive-wedding-event-hire.php) ... I tried deleting archive-wedding-event-hire.php to see if that would make the archive-hire.php work but it didn't.
Scratching my head.
Thanks,
Elise
June 7, 2013 at 5:51 pm #44663rfmeierMemberThat rings a bell fror me. Although since I am unsure how you are creating your custom post types. Plugin? Custom Code? Either way, when you create a custom post type for the first time in WordPress you need to flush your permalinks so the rewrite API has knowledge of the post type slug.
This can be done with code or you can go to your permalink settings and re-save them.
Try this with your new post type slug and let me know how it works out. I am not even sure this is the issue.
June 7, 2013 at 6:45 pm #44670eliserochelleMemberOh of course! Ok I saved the permalinks again and now all is well!
Thank you so much! I will now add re-saving the permalinks as one of my checks 🙂
You are a legend!
June 7, 2013 at 6:47 pm #44671rfmeierMemberYou are welcome. I am glad I could help.
I am curious. How are you creating your custom post types?
June 7, 2013 at 6:52 pm #44672eliserochelleMemberOh sorry I forgot to answer that. I'm using Custom Post Type UI by WebDevStudios (free) and I'm also using Advanced Custom Fields plugin but so far I can't work out how to actually display the fields ...
I'm quite excited to be getting acquainted with these custom post types 🙂
June 7, 2013 at 7:02 pm #44673rfmeierMember -
AuthorPosts
- The forum ‘Design Tips and Tricks’ is closed to new topics and replies.