• Resolved Trell

    (@thisnluv)


    I have a masonary styled grid on my blog and I am wanting to create a custom post type for my instagram posts, and shop feed items.

    For example:

    <script type="text/html" id="post-item-template"><div class="item post" data-type="post">
    	<div class="post-item {text_color}">
    	<a class="btn overlay-btn" href="{url}">
    		<figure class="image post-image">
    			<img src="{image_url}">
    		</figure>
    		<header class="header">
    			<span class="label">{category}</span>
    			<h3 class="title post-title">{title}</h3>
    			<span class="read-more-btn tertiary-btn">read more</span>
    		</header>
    	</a>
    </div></div></script>
    
    <script type="text/html" id="instagram-item-template"><div class="item instagram {size}" data-type="instagram">
    	<div class="instagram-item ">
    	<a class="btn" href="{url}" target="_blank">
    		<figure class="image instagram-image">
    			<img src="{image_url}">
    		</figure>
    		<div class="instagram-meta meta">
    			<div class="instagram-logo">
    				<i class="icon-instagram icon"></i>
    				<span class="name">@thehautepursuit</span>
    			</div>
    			<div class="instagram-stats stats">
    				<span class="likes">{likes}</span>
    				<span class="comments">{comments}</span>
    			</div>
    		</div>
    	</a>
    </div></div></script>
    
    <script type="text/html" id="product-item-template"><div class="item product {size}" data-type="product">
    	<div class="product-item {size}">
    	<a class="btn overlay-btn" href="{url}">
    		<figure class="image product-image">
    			<img src="{image_url}">
    		</figure>
    		<header class="header">
    			<span class="label">THPSHOP</span>
    			<h4 class="title product-title">{title}</h4>
    			<span class="price">{price}</span>
    			<span class="buy-btn tertiary-btn">buy now</span>
    		</header>
    	</a>
    </div></div></script>
    
    <script type="text/html" id="custom-item-template"><div class="item custom {size}" data-type="custom">
    	<div class="custom-item {text_color}">
    	<a class="btn overlay-btn" href="{url}">
    		<figure class="image custom-image">
    			<img src="{image_url}">
    		</figure>
    		<header class="header">
    			<span class="label"></span>
    			<h3 class="title custom-title">{title}</h3>
    			<span class="read-more-btn tertiary-btn">read more</span>
    		</header>
    	</a>
    </div></div></script>

    This is an exmaple from a live site that I am wanting to emulate…

    How is this done? Any reference material or advice would be great…

Viewing 8 replies - 1 through 8 (of 8 total)
  • Hi,

    Here’s a handy guide for querying custom post types in your templates: https://pippinsplugins.com/querying-custom-post-types-in-your-theme-templates/

    Moderator bcworkz

    (@bcworkz)

    FYI, you do not need to create a new query as suggested in the article linked above. Though it will work, it’s not very efficient to toss out the original main query and make a new one. I prefer to use ‘pre_get_posts‘ action to alter the main query to my liking before it is run.

    The above linked article wants you to run the main query, then ignore the results and make a new one. However, if you are using the main query, then running a second query to get more content for a different section on the same page, then creating a new query as suggested is the way to go.

    Thread Starter Trell

    (@thisnluv)

    Is this all necessary to just get an instagram photo and its likes onto my feed as a post in my grid feed?

    Geesh..

    In my grid builder I have the option to tick and load ‘posts, portfolio items, grid items’
    I was just wanting to add an ‘instagram’ post type that would be a square instead of the rectangles I have on my blog.

    Thread Starter Trell

    (@thisnluv)

    Live example here with 3 post types.
    Blog posts, instagram posts, and shop item posts in a masonry grid.. am I off base here? or is it more complicated than I’m suggesting?

    How you do it, with pre_get_posts or with a whole new custom query depends on what exactly you want to do.

    I can’t say anything to your grid builder. What grid builder are you using? You should contact their support if you want to use custom post types in their plugin.

    Thread Starter Trell

    (@thisnluv)

    I’m using the Grid Builder Visual Composer elemnt. It says I can use a variety of different plugins to create different post types, I’m just now sure exactly how to do that.

    I see. Unfortunately the wordpress.org forum policies don’t allow the support of commercial products here. The VC developer should be able to help you though!

    Thread Starter Trell

    (@thisnluv)

    Got it… Thanks..

Viewing 8 replies - 1 through 8 (of 8 total)

The topic ‘Adding custom post types into latest post grid plugin’ is closed to new replies.