How To Duplicate Minimum Portfolio for Custom Post Archive

Community Forums Forums Design Tips and Tricks How To Duplicate Minimum Portfolio for Custom Post Archive

This topic is: not resolved

This topic contains 10 replies, has 2 voices, and was last updated by  rfmeier 1 year, 3 months ago.

Viewing 11 posts - 1 through 11 (of 11 total)
  • Author
    Posts
  • #44452

    eliserochelle
    Participant
    Post count: 14

    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
    #44466

    rfmeier
    Participant
    Post count: 597

    Hello,

    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.


    #44479

    eliserochelle
    Participant
    Post count: 14

    Thanks 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

    #44491

    rfmeier
    Participant
    Post count: 597

    Just curious. What is your post type slug?


    #44654

    eliserochelle
    Participant
    Post count: 14

    Hi,

    it’s wedding-event-hire

    should it perhaps only be one word?

    thanks,

    Elise

    #44660

    eliserochelle
    Participant
    Post count: 14

    Ok 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

    #44663

    rfmeier
    Participant
    Post count: 597

    That 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.


    #44670

    eliserochelle
    Participant
    Post count: 14

    Oh 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!

    #44671

    rfmeier
    Participant
    Post count: 597

    You are welcome. I am glad I could help.

    I am curious. How are you creating your custom post types?


    #44672

    eliserochelle
    Participant
    Post count: 14

    Oh 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 :)

    #44673

    rfmeier
    Participant
    Post count: 597

    Okay. I was just curious.


Viewing 11 posts - 1 through 11 (of 11 total)

You must be logged in to reply to this topic.