- This topic has 22 replies, 4 voices, and was last updated 5 months, 2 weeks ago by
David.
-
AuthorPosts
-
October 6, 2022 at 6:42 am #2365178
Lina
I would like to create a portfolio template that is separate from my blog template, but with the same type of functionality. Meaning, I would like to be able to have “previous portfolio piece,” “next portfolio piece” sort of functionality – as you would with a blog.
I just don’t want the portfolio pieces and blog pieces to mix together.
What is the best way to achieve this?
Thank you.
P.S. What i’m trying to achieve is a blog section that looks like a typical blog, and a portfolio section that has a three column layout instead of the typical blog layout. I want the two areas of the website to look different.
October 6, 2022 at 8:39 am #2365409David
StaffCustomer SupportHi there,
ideally you would create a Custom Post Type for your Portfolio post type.
Then we could use either Filter Hooks, Block Elements or GB Query Loop blocks to display the portfolio archive and make changes to how the single portfolio is displayed.
Do you have any experience with creating CPTs ?
As the alternative to that would be to use a regular Post and create a Category for your Portfolio posts, and we can assist with some PHP / Block Elements to change its layout.
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 6, 2022 at 10:21 am #2365506Lina
Hi David,
Only a little bit – I’m trying to understand it better.
For now, I created a Custom Post Type using Code Snippets, and put a couple of posts under that category, so I can try to see if it will work.
I’ve also created a separate .php file called single-portfolio.php, so that’s it created a new Template Category named “Portfolio.”
I’d like to now make a custom template for the single posts under the Portfolio Post Type, but not sure how to go about it.
October 6, 2022 at 7:20 pm #2365766Fernando Customer Support
Hi Lina,
Here’s an article you may refer to regarding to this: https://docs.generatepress.com/article/setting-up-a-simple-custom-post-type/
October 7, 2022 at 10:00 am #2366471Lina
Thank you very much for your direction, Fernando. This has been a very educational exercise for me.
I have all the single posts created in my Portfolio now, and looking the way I want them to look.I would like to modify the archive page that displays the posts in that category, but I’m not sure how.
Under Pages, I see that the blog archives page is there, and classified as a “Posts page.” I’m assuming that somewhere in wordpress, I can also find the archive page for my Portfolio, so that I can modify it?
October 8, 2022 at 5:35 am #2366977David
StaffCustomer SupportWhen you created your CPT, there are various support parameters you can include. Did you include the
has_archive
?More info here:
https://developer.wordpress.org/reference/functions/register_post_type/Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 8, 2022 at 11:56 am #2367306Lina
I believe so, yes.
October 9, 2022 at 4:28 am #2367595David
StaffCustomer SupportOk, go to Settings > Permalinks and click Save Changes, this will rebuild the permalinks.
You should now be able to view the archive with theyourdomain.com/portfolio
URIDocumentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 9, 2022 at 4:39 am #2367608Lina
Yes, the page has been there the whole time.
What I want to know is how to modify the layout and components of this page?
Specifically, can it be modified in WordPress, or can it only be modified manually through the php file?Thank you
October 9, 2022 at 6:01 am #2367700David
StaffCustomer SupportTheres quite a few options available to us.
Whats the main requirement ? To get the portfolio posts to display in columns ? Or do you need to do more than that.Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 9, 2022 at 7:59 am #2367924Lina
Ideally, I would like the portfolio posts to display in a masonry grid.
If that’s too complicated, I would settle for columns as a secondary option ๐
I’m working hard at trying to figure this out myself, and what I’ve tried so far is creating a Portfolio page that pulls content from an element page I’ve set to display content for the Portfolio Archive.
This has resulted in a less than perfect result you can see on the page I’ve linked to.
If you have any suggestions as to how I can achieve the masonry grid effect, I would be most thankful.October 10, 2022 at 3:44 am #2368545David
StaffCustomer SupportEnable the Blog Module in Appearance > GeneratePress.
This will allow us to use the columns and masonry functions, and we can apply them specifically to your CPT using some PHP.For columns see here:
So, make sure the CPT slug is correct and should be able to do:
// Enable columns add_filter( 'generate_blog_columns', function( $columns ) { if ( 'portfolio' === get_post_type() && ! is_singular() ) { return true; } return $columns; } ); // Set Columns to 33% add_filter( 'generate_blog_get_column_count','tu_search_column_count' ); function tu_search_column_count( $count ) { if ( is_post_type_archive( 'portfolio' ) ) { return 33; } return $count; } // Enable Masonry add_filter( 'generate_blog_masonry','tu_portfolio_masonry' ); function tu_portfolio_masonry( $masonry ) { if ( is_post_type_archive( 'portfolio' ) ) { return 'true'; } return $masonry; }
Documentation: http://docs.generatepress.com/
Adding CSS: http://docs.generatepress.com/article/adding-css/October 10, 2022 at 9:22 am #2369009Lina
Okay, I’ve added this code in Code Snippets, and it seems to have changed the layout of the Porfolio Archive Page.
But how do I modify other aspects of this page?
Namely, how can I get the header image container to disappear all-together, and each post link to display as a photo that then leads to each individual entry?
October 10, 2022 at 12:12 pm #2369150Ying
StaffCustomer SupportTo build the layout of the blog or cpt archive, you can use a
block element - content template
:
https://docs.generatepress.com/article/block-element-content-template/The video should help you understand the concept.
let us know if there’s anything unclear ๐
October 10, 2022 at 2:22 pm #2369227Lina
Hi Ying
I promise, this is what I’ve been doing, trying to get things I do in the Portfolio Archive template to actually show up on the page.
They are just not showing up. Is there something I’m missing? Is there additional php code that needs to be included in the Custom Post Type snippet to make sure these things are going to show up.
For example: the title of each post shows up, but the image doesn’t. Basically, only the title shows up.
-
AuthorPosts
- You must be logged in to reply to this topic.