Viewing 8 posts - 1 through 8 (of 8 total)
  • Author
    Posts
  • #1466954

    Hi!
    I would like to know if it is possible to achieve the following:
    I activated the post formats for portfolio items by adding the following code to the functions.php file of my enfold child theme.

    function add_post_formats_to_portfolio() {
    add_post_type_support(‘portfolio’, ‘post-formats’);
    }
    add_action(‘init’, ‘add_post_formats_to_portfolio’);

    I’m using a page to show portfolio items that contain a masonry, and I want the icons relating to each type of post format to appear, as in normal publications.
    Is it possible?

    Thank you!

    #1467048

    Hey luismiguelsantos,

    Thank you for the inquiry.

    Would you mind providing a screenshot of the changes that you’d like to implement and provide a link to the page? You can use platforms like Savvyify, Imgur or Dropbox to upload and share the screenshot.

    Best regards,
    Ismael

    #1467063

    Dear Ismael,

    The site has a news page (with normal posts) where you can see the first two posts with the format “video” and “quote”. They have the icons on top of the image.

    What I want is for the icons for each type of format to appear on the “testimonials” page (with portfolio items).

    As I said, I activated post formats for portfolio items, but the icons do not appear.

    You can see it here: https://dev.triton.pt/bialall/

    Thank you

    #1467164

    Hi,

    Thank you for the update.

    You can try the following filter in the functions.php file. Make sure to replace the image path with your own.

    function avf_masonry_entry_title_mod( $the_title, $entry, $atts ) {
        $post_format = get_post_format( $entry['ID'] );
    
        $icon_url = '';
        switch ( $post_format ) {
            case 'video':
                $icon_url = 'path/to/video-icon.png';
                break;
            case 'audio':
                $icon_url = 'path/to/audio-icon.png';
                break;
            case 'gallery':
                $icon_url = 'path/to/gallery-icon.png';
                break;
            default:
                $icon_url = 'path/to/default-icon.png';
                break;
        }
    
        $the_title .= " <span class='av-masonry-icon'><img src='{$icon_url}' alt='post-format-icon' /></span>";
    
        return $the_title;
    }
    add_filter( 'avf_masonry_entry_title', 'avf_masonry_entry_title_mod', 10, 3 );
    
    

    Best regards,
    Ismael

    #1467217

    Hi,
    It works, thank you.

    One last question:

    How can I change the colour of the text that is exactly beneath the title?
    It’s not the full text, just the one that is under the title.

    I tried HTML markups, but they don’t work on (entry-content).

    I need:
    • Title (White)
    • Subtitle (red)
    • Text (white)
    Thank you for your help.

    #1467250

    Hi,

    Thank you for the update.

    We can only target either the title or the whole content. If you want to target a specific line of text, make sure to wrap it inside a unique container or element. Example:

    
    <p class="av-text-red">AMCHAM</p>
    
    

    You can then apply the color to the av-text-red element.

    .av-text-red {
       color: red;
    }

    Best regards,
    Ismael

    #1467327

    Hi!
    I manage to resolve the issue with this: https://kriesi.at/support/topic/add-a-custom-field-in-the-masonry-post-blog-list-element/

    Thank you very much for your help.

    You can close this.

    #1467419

    Hi,

    Great! Glad to know that this has been resolved. Please feel free to open another thread if you have more questions.

    Have a nice day.

    Best regards,
    Ismael

Viewing 8 posts - 1 through 8 (of 8 total)
  • The topic ‘Portfolio items and Format posts’ is closed to new replies.