Viewing 12 posts - 1 through 12 (of 12 total)
  • Author
    Posts
  • #1462084

    Hey!
    I need a little help, mainly pointers in the right direction.

    I display team members via a portfolio grid. Some are regulars, some are guests. I want to give my guests a is_guest = true identifier (done via ACF).

    Now I want to display a ribbon on the feature pic in the portfolio grid if the portfolio is_guest = true.

    I added css code, what are my next steps?

    I am mainly looking for the file I need to work on in my child theme that displays the portfolio grid. Could you let me know which one it is and where I find it?
    Is it this one:
    /enfold/config-templatebuilder/avia-shortcodes/portfolio

    And if so: how do i need to safe it in my child theme?

    Thank you.

    #1462092

    Hey fabienneRedUmb,

    Thank you for the inquiry.

    Yes, you have to override the shortcode file in your child theme. Please check the documentation below:

    // https://kriesi.at/documentation/enfold/intro-to-layout-builder/#add-elements-to-alb

    You will find the portfolio entry container around line 966 of the ]enfold/config-templatebuilder/avia-shortcodes/portfolio/portfolio.php file.

    $post_class = "post-entry post-entry-{$the_id} grid-entry-overview grid-loop-{$post_loop_count} grid-parity-{$parity} {$last}";
    

    Best regards,
    Ismael

    #1462096

    Thank you.
    I am a bit stumped. I thought it is a quite easy fix, but I run into problems.

    My idea is to first figure out how to get anything shown on top of the image. Lets say ‘Test’ and then when that works make it so that it only displays when the portfolio item has a certain attribute. But I am already struggling to get “test” to show up.

    Here is the code I found to change:

    $image = get_the_post_thumbnail( $the_id, $image_size, $image_attrs );
                        if( ! empty( $image ) )
                        {
                            $output .= '<div class="av_table_col portfolio-grid-image">';
                            $output .= "<{$link_markup[0]} data-rel='grid-" . avia_post_grid::$grid . "' class='grid-image avia-hover-fx'>{$custom_overlay} {$image}</{$link_markup[1]}>";
                            $output .= '</div>';
                        }
                        $output .= '<footer class="entry-footer"></footer>';
                        $output .= '</article>';
                        $output .= '</div>';

    And here is the code I change it to:

    $image = get_the_post_thumbnail($the_id, $image_size, $image_attrs);
    if (!empty($image)) {
        $output .= '<div class="av_table_col portfolio-grid-image">';
        $output .= "<{$link_markup[0]} data-rel='grid-" . avia_post_grid::$grid . "' class='grid-image avia-hover-fx'>";
        $output .= "{$custom_overlay} {$image}";
        $output .= "<div class='overlay-text'>test</div>"; // Add this line for the overlay
        $output .= "</{$link_markup[1]}>";
        $output .= '</div>';
    }
    $output .= '<footer class="entry-footer"></footer>';
    $output .= '</article>';
    $output .= '</div>';

    I also added the following passage to my style.css

    .grid-image {
        position: relative; 
        display: inline-block;
    }
    
    .grid-image img {
        display: block; 
        width: 100%;
        height: auto;
    }
    
    .overlay-text {
        position: absolute;
        bottom: 10px;
        left: 10px; 
        background-color: rgba(255, 255, 255, 0.7); 
        color: #dada21; 
        padding: 5px 10px; 
        border-radius: 5px; 
        font-size: 16px; 
        font-weight: bold; 
        box-shadow: 0 2px 4px rgba(0, 0, 0, 0.2);
    }

    Unfortunately I dont get the text to show up.
    Where is my mistake?

    #1462133

    Hi,

    Thank you for the update.

    You can just directly apply the class name to $post_class variable that we mentioned above.

    $is_guest = get_field('is_guest', $the_id);
    $guest_class = $is_guest ? 'is-guest' : '';
    
    $post_class = "post-entry post-entry-{$the_id} grid-entry-overview grid-loop-{$post_loop_count} grid-parity-{$parity} {$last} {$guest_class}";
    
    

    You can then use the “.is-guest” selector to add the ribbon or adjust the style of the guest items.

    .is-guest {
       /* Styles for guest users */
       /* Example styles: */
       color: #333;
       background-color: #f0f0f0;
       /* Add more styles here */
    }

    Best regards,
    Ismael

    #1462136

    Why don’t you assign an additional special category to these portfolios? “Guest”

    As far as I know, no further intervention is necessary then!

    The Portfolio Grid is now: Whether you have selected the sort option or not, this taxonomy appears there as the class on grid-entry : XYZ_sort
    In your case then guest_sort

    #1462274

    Thank you – I tried that, but I cant get it to work. I do display the portfolios in a portfolio grid – does this have something to do with it?

    #1462275

    Sounds easy enough!
    I added a portfolio category ‘Gast’ and added the following function to ad a custom class to the categorized portfolios, but I cant seem to get the banner to show up.

    I added this to functions.php of the child theme:

    function add_custom_category_class($classes) {
        if (is_category('378')) {
            $classes[] = 'category-378';
        }
        return $classes;
    }
    add_filter('body_class', 'add_custom_category_class');

    and this to my css:

    .category-378 .grid-entry .inner-entry {
      position: relative;
    }
    
    .category-378 .grid-entry .inner-entry::before {
      content: 'Gast';
      position: absolute;
      top: 0;
      left: 0;
      width: 100%;

    height: 50px;
    background-color: rgba(255, 0, 0, 0.8);
    color: white;
    display: flex;
    align-items: center;
    justify-content: center;
    font-size: 18px;
    font-weight: bold;
    transform: rotate(-45deg);
    transform-origin: top left;
    z-index: 1;
    }

    #1462281

    Ok, I tried Ismaels version again and I can get the is-guest class to stick – finally!
    But for some reason I cant target it.

    I will keep trying and update on the go. I am quite sure this specific issue might be useful for some people.

    #1462282

    I managed to add a border around the whole entry, but I cant get a label to show up on the image.

    #1462283

    Alas! This worked as well, I can target guest_sort (gast_sort in my case) but I am too stumped in creating a html code that actually displays the label on the picture.

    All I can do is add a border around it.

    #1462284

    Finally success!

    .gast_sort {
        position: relative; 
    }
    
    .gast_sort .grid-image {
        position: relative; 
        display: inline-block; 
        overflow: hidden; 
    }
    
    .gast_sort .grid-image::before {
        content: 'Gast'; /
        position: absolute; 
        bottom: 0; 
        left: 0; 
        width: 100%; 
        background-color: rgba(218, 218, 33, 0.5); 
        color: #ffffff; 
        padding: 5px 10px; 
        box-sizing: border-box;
        font-weight: bold;
        font-size: 24px; 
        z-index: 10; 
        text-align: center; 
    }
    #1462348

    Hi,

    Great! Glad to know that you managed to work this out. Please feel free to open another thread if you have more questions about the theme.

    Have a nice day.

    Best regards,
    Ismael

Viewing 12 posts - 1 through 12 (of 12 total)
  • The topic ‘show marker in certain pictures in portfolio grid’ is closed to new replies.