Show add to favorites in Archive posts / Loop posts

Support MB Favorite Posts Show add to favorites in Archive posts / Loop posts

Viewing 2 posts - 1 through 2 (of 2 total)
  • Author
    Posts
  • #32912
    MariusMarius
    Participant

    Hi,

    i would like to show the Add to favorites Icon Button in the Posts of an Archive page. I am using MB Views for the Loop like this:

    {% for post in query.posts %}
    <div class="exposee-teaser">
        <figure>
            <a href="{{ post.url }}" class="exposee-teaser-wrapperlink">                  
                <div class="exposee-custom-bg" style="background-image: url('{% set item = attribute( post.thumbnail, 'exposee-teaser' ) %}{{ item.url }}')"></div>                                 
            </a>
        </figure>
        <div class="exposee-teaser--text">
            <a href="{{ post.url }}" ><h4>{{ post.title }}</h4></a>
            <div class="exposee-details">
                <a href="{{ post.url }}" >Details</a>
                [mbfp-button class="custom_class" icon="heart" show_icon="true"]
            </div>
        </div>
    </div>
    {% endfor %}

    But the Shortcode is working for the current Archive page and not every individual Posts in the loop.

    Is there a way to achieve this: To get a Favorites button for every post in a loop and the possibility to add an individual post on an archive page to the favorites?

    Thanks in advance!

    Greetings
    Marius

    #32924
    Long NguyenLong Nguyen
    Moderator

    Hi Marius,

    You need to pass the post ID to the attribute id of the button shortcode to show a favorite button for each post on the archive page. For example:

    <div class="exposee-details">
        <a href="{{ post.url }}" >Details</a>
        [mbfp-button id="{{ post.ID }}" class="custom_class" icon="heart" show_icon="true"]
    </div>

    Please get more details on the documentation https://docs.metabox.io/mb-favorite-posts/#shortcodes

Viewing 2 posts - 1 through 2 (of 2 total)
  • You must be logged in to reply to this topic.