• Skip to primary navigation
  • Skip to content
  • Skip to primary sidebar
  • Skip to user navigation

PopWP

WordPress and Genesis Tutorials

  • Get Started
  • About
  • Archive
  • Services
  • Membership
  • My Account

Related custom post type listing on CPT singular Post with custom fields using Pods

Last Updated on October 26, 2018 Favorited: 1 times

This tutorial Provides the steps to display related post from the current category on singular post excluding the current post supports custom post types and taxonomy.

Prerequisite:

It is assumed that You have the following points done. We have the following:
Custom Post Type → book
Custom Taxonomy → book_type

STEP 1

The first step is to support shortcodes within the loop query. Add this in wp-config.php

define('PODS_SHORTCODE_ALLOW_SUB_SHORTCODES',true);

STEP 2

It is time to allow shortcodes in Template. Add this in functions.php

/**
* Allow Pods Templates to use shortcodes
*
* NOTE: Will only work if the constant PODS_SHORTCODE_ALLOW_SUB_SHORTCODES is defined and set to
*/
add_filter( 'pods_shortcode', function( $tags )  {
    $tags[ 'shortcodes' ] = true;
    
    return $tags;
    
});

STEP 3

Create a pod template name > related < and paste this

<div class="related">
    <div class="related-wrap">
    <h3><a href="{@permalink}" class="my-title">{@post_title}</a></h3>
    <span class="my-excerpts">{@post_excerpt}</span>
    </div>
</div>

Customize this template as per your needs.

STEP 4

Create a new Pod Template name >php< and paste

[[pods template="related" name="book" where="(regio.term_id = '{@regio.term_id}') AND (ID != '{@ID}')" limit="3"]]

STEP 5

Create a widget area after entry on the singular post. and Drag Pod single item to this section.

a) Select Pod to custom post type of yours.
b) Tick > Use current post (singular) or term (term archive)
c) Select Template php(we have created above)

Save it.

Pods > Settings and clear Pod cache.

Related Posts

  • Single Post Design having social Profiles for Author and Related Posts in Infinity Pro
  • Add Video in entry content using custom fields on singular post
  • Getting Started with Pods framework in Genesis WordPress
  • Simple Related Posts in Genesis
  • WordPress, Genesis and Custom Post Types

Categories: Free Content, Genesis Tutorials Tags: Pods, related, related posts

Reader Interactions

Primary Sidebar

Search

WPEngine WordPress Hosting, Perfected.

Hosting You are looking for?.
Perfect solution for small business to global enterprise.

Learn more

StudioPress Genesis Theme Framework

The No.1 Theme Provider.
Creative, SEO rich Theme for all niche projects.

Learn more

Categories

  • Free Content
  • Genesis Tutorials
  • Premium Content
  • Snippets
  • What's New?
  • WordPress Tutorials

Tag Cloud

Archive Background Section blog canvas menu center logo columns conditional tags CSS CSS Grid custom Customizer custom post type Custom Post Types custom template Custom Widget effect eNews Extended Featured Image front-page Genesis Genesis Sample header right hero section Image Background js layout left menu Logo menu Navigation Menu newsletter post page related posts responsive menu search search widget Shrinking Logo site header slide in-out Stylesheet Template Utility Bar Video Background widgets WordPress

Built with Genesis Framework + WordPress by Aryan Raj

  • Contact
  • FAQ
  • Disclaimer
  • Privacy Policy
  • Copyright Policy
  • Terms of Service