Column portfolio page


I saw this code to call posts in columns which I seek-

// Replace Beans loop with a custom 6 posts loop.
beans_modify_action_callback( 'beans_loop_template', 'example_view_latest_posts' );

function example_view_latest_posts() {
 // Get the 6 latests posts.
 $posts = get_posts( array( 'posts_per_page' => 6 ) );

 foreach ( $posts as $post ) {
   // Setup the postdata.
    global $post;
   setup_postdata( $post );

    // Display post title and image using Beans fragments.
    beans_post_title();
   beans_post_image();
 }
}

I'm thinking this would be a good practice to use for a portfolio post type?

or what would be the better way to build a portfolio -typed page that links to a portfolio-single page.


Hi Dee,

I am not sure I understand what you are after. Could you perhaps give us a bit more details about what you are trying to achieve?

Thanks,


Hi Thierry,

To clarify - I want to register a post-type and call all the item of that post portfolio on a single page. The above code I am wondering if that world be good practice to call in a grid format.


Ok I remember uikit has this example.

https://getuikit.com/v2/docs/layouts_portfolio.html

I How can I use a portfolio post type to create column grids. which will also act like a single portfolio page when clicked on.


Hi Dee,

While I will love to build all the snippets and share it with you and while I am always willing to help, I can unfortunately not go into such deep customization πŸ˜‰ To point you to the right direction, the snippet previously shared allows you to add any HTML in it. All you have to do is adding the UIkit grid HTML as explained in their documentation. Since you are in the loop, you can easily create a link to the single item using WordPress Core functions (I will let you look into that, there is loooooot of documentation on the web). Regarding filtering, UIkit filters can only be used with the Dynamic Grid which you will have to enqueue if you want to use it, but I can already tell you that you will face challenges with the pagination πŸ˜‰ If I were you, I would add categories for the items and use that as the filters.

Have fun,


Thierry, I have the perfect structure for what I want building my vision. The grid component can be tricky. I understand what you are saying. I was only wondering if the code from the first post would be realstic to use to call the posts in the portfolio category.


Write a reply

Login or register to write a reply, it's free!