Custom Fields
Re-Envisioned
Support MB Views Creating a "CPT Widget" using metabox View

  • Creator
    Topic
  • #28462
    Viktor Iwan
    Participant

    Hello
    i'm new to metabox (from toolset) and i have question.
    i wanted to create a "widget" using the mb view that shows the "Latest News" from the custom post type "news"
    i tried creating view but the url/permalink and the image is showing up empty (only the post_title works)
    any suggestion where i did it wrong?
    Thank you

    {% set news = {post_type: 'news', posts_per_page: 5} %}
    {% set newss = mb.get_posts( news ) %}
    
    {% for news in newss %}
    
        <div class="list_news_page_item">
            <div class="news_cover_image">
                <a href="{{ news.url }}">
                <img src="{{ news.news_cover_image.medium.url }}" width="{{ post.news_cover_image.medium.width }}" height="{{ news.news_cover_image.medium.height }}" alt="{{ news.news_cover_image.medium.alt }}">
                </a>
            </div>            
    
            <div class="news_title">
                <a href="{{ news.post_url }}">
                {{ news.post_title }}
                </a>
            </div>
        </div>
    {% endfor %}
Viewing 3 replies - 1 through 3 (of 3 total)
Viewing 3 replies - 1 through 3 (of 3 total)
  • You must be logged in to reply to this topic.