Custom Fields
Re-Envisioned
Support MB Favorite Posts Show add to favorites in Archive posts / Loop posts

  • Creator
    Topic
  • #32912
    Marius
    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

Viewing 1 replies (of 1 total)
  • Author
    Replies
  • #32924
    Long 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 1 replies (of 1 total)
  • You must be logged in to reply to this topic.