-
AuthorPosts
-
October 19, 2022 at 4:34 pm #1369430
Hi I was just wondering the post type name for Portfolio entries.
I am trying to populate the excerpt of these posts with an ACF field. See code below but I can’t seem to make it work…
add_filter( 'get_the_excerpt', function ( $excerpt, $post ) { if ( ! empty( $excerpt ) ) { return $excerpt; } // On a specific post type, use an ACF field value as the excerpt. if ( $post->post_type === 'portfolio' ) { $excerpt = get_field( 'the_project', $post->ID ); } return $excerpt; }, 10, 2 );
Thanks in advance
Dominic
October 20, 2022 at 3:47 am #1369514Hey domchocolate,
Thank you for the inquiry.
Which element are you using to display the portfolio entries? It is possible that the template is not set to display the excerpt. If you are using the default portfolio grid element, the element should display by default depending on the element settings but you may need to replace the filter above with the avf_portfolio_grid_excerpt filter to override the value of the excerpt.
Example:
add_filter('avf_portfolio_grid_excerpt', function($excerpt, $entry) { $excerpt = get_field( 'the_project', $entry->ID ); return $excerpt; }, 10, 2);
Best regards,
IsmaelOctober 20, 2022 at 9:36 am #1369546Hi thanks for that. I was using blog posts but I am swapping out to a portfolio grid because for some reason blog posts isn’t being responsive. Do you know why I can’t make a blog post stretch 4 columns desktop, 2 on tablet, 1 on mobile. It crams 4 columns across it all.
Dominic
PS Code works well
- This reply was modified 2 years ago by domchocolate.
October 21, 2022 at 9:35 am #1369695Hi,
Thank you for the update.
The columns should respond automatically on different screen sizes. Where can we check the issue? If you need to break the rows to a single column on mobile, just add this css code.
@media only screen and (max-width: 767px) { /* Add your Mobile Styles here */ .responsive #top #wrap_all .slide-entry { width: 100%; margin-left: 0; } }
Best regards,
IsmaelOctober 21, 2022 at 10:27 am #1369708Thanks.
Here’s an example here: https://owe.brother.design/post-test/ – it just gets locked into 4 columns.
October 21, 2022 at 1:46 pm #1369724Hi,
The blog element css sets the width for the items at 48% below 767px, so for tablet 768px – 1024px it would still be 4 across,
so to achieve 4 columns desktop, 2 on tablet, 1 on mobile, I recommend this css:@media only screen and (min-width: 501px) and (max-width: 1024px) { .responsive #top #wrap_all #main .slide-entry { width: 48%; } .responsive #top #wrap_all #main .avia-content-slider-even .slide-entry.slide-parity-odd { margin: 0; clear: both; } .responsive #top #wrap_all #main .slide-entry { width: 48%; margin-left: 4%; } .responsive #top #wrap_all #main .slide-entry .slide-content { width: 260px; margin: auto; } } @media only screen and (max-width: 500px) { .responsive #top #wrap_all #main .slide-entry { width: 100%; margin: 0; } .responsive #top #wrap_all #main .slide-entry .slide-content { width: 260px; margin: auto; } }
In my testing I found that your images have a width of 260px, this made the content below look off to the left, so I added a width of 260px to the content also to look better:
Now the reason the columns were not breaking to two across at 767px like that should was because in your child theme stylesheet on line 768 you added this css to change the display to flex, I assume that you added this for a different element or for a specific page so you will need to adjust it to not conflict with this page or remove it.
.slide-entry-wrap { display: flex; justify-content: center; margin-bottom: 40px!important; }
After applying the css above, please clear your browser cache and check.
Best regards,
MikeOctober 21, 2022 at 6:16 pm #1369752Thanks Mike
That makes sense!
October 21, 2022 at 6:28 pm #1369753Hi,
Glad we were able to help, if you have any further questions please create a new thread and we will gladly try to help you. Thank you for using Enfold.Best regards,
Mike -
AuthorPosts
- The topic ‘What is the custom post type name for Portfolio entries?’ is closed to new replies.