Using Pods CMS with Roots WordPress Theme

I am having problems displaying Pods data in a custom WordPress template using the Roots Theme

I have setup a “Products” Pod, a Pods page “products/*” that has been assigned the custom WordPress template. Roots uses a Theme Wrapper file that doesn’t appear to work on Pods pages. Has anyone come across this before and perhaps found a solution?

Related posts

Leave a Reply

2 comments

  1. You can add a custom template and put pods_content() in it where you want to output the content.

    Or you can hook into get_template_part_templates/content and check the second value for ‘page’ and then run the pods_content() there.

    add_action( 'get_template_part_templates/content', 'hook_into_pods_page', 2 );
    
    function hook_into_pods_page ( $slug, $name ) {
        if ( is_pod_page() && 'page' == $name )
            pods_content();
    }
    
  2. I have no idea if this is a “good” solution or not. I started using WordPress yesterday.

    That said, here’s my solution which seems to work well.

    In your pods page templates put the output for the page into $pods_content

    $pods_content = $cookie->template('', get_pod_template('market-single'));
    ob_start();
    include get_stylesheet_directory() . '/base.php';
    print ob_get_clean();
    

    Then in base.php replace the roots_template_path include with this:

    if ($pods_content): print $pods_content; else: include roots_template_path(); endif;