• Resolved pmascis

    (@pmascis)


    Hi,

    Thanks for your plugin, it seems to be just what I’m after, but I’m having an issue I am hoping you can help me with.

    I have had success with the plugin on a regular page post type.
    I created a page called ‘new-content-to-pull’.
    Within the regular page post types text editor I added in shortcodes for testing.
    PREVIEW
    On the front end, it worked fine.
    PREVIEW

    I need to use a template file to display the other page’s content.
    So I created a template file and added in the required code to display the fields etc.
    PREVIEW

    This worked on the front end.
    PREVIEW

    Interestingly though, I couldn’t use the following together.
    [insert page=’new-content-to-pull’ display=’views/template-test.blade.php’]
    [insert page=’new-content-to-pull’ display=’title’] (or link, all etc)

    As it would only display the template and not the title or link, all etc.
    Not certain if by design or a bug. Anyway…

    I mostly need this insert page functionality for use in a Custom Post Type.
    But I couldn’t seem to get it working. I repeated the following steps.

    Created a page within the ‘Landing Page (landing)’ Custom Post Type.
    Added in the saem stuff.
    PREVIEW

    It again worked on the front end.
    PREVIEW

    I changed the output to use a template file instead.
    PREVIEW

    Unfortunately, it doesn’t render on the front end at all.
    I just get an empty div with no content.
    PREVIEW

    It doesn’t even show up the hard coded test text within the template file ‘This text is being pulled from within template-test.blade.php’
    So it doesn’t seem to be anything to do with not having the loop right or the fields correct etc.

    Any ideas where I am going wrong? Your help would be much appreciated.

    Cheers.

    Sorry for my previous post to the support forum, which I tried to remove.
    I was having a similar issue where only the DIV would show up, but it was because I was trying to call a shortcode within an ACF text field, but I had to enable ACF text fields to allow rendering of shortcodes.

    • This topic was modified 4 years, 5 months ago by pmascis.
Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter pmascis

    (@pmascis)

    I created a new WordPress install and tested it with the 2020 theme and a plain version of the current theme I’m using.
    I found out it’s something to do with my theme, but can’t really narrow it down.
    You can disregard this thread as I don’t think it’s easy to narrow down a solution, thanks.

    Plugin Author Paul Ryan

    (@figureone)

    Sometimes it’s hard to get the template files working within custom themes because they expect slightly different contexts with the WordPress globals like $post.

    Maybe check to make sure you’re calling the_post() in your custom template to populate the globals so the template functions work?

    Wes’s tutorial might offer some insight too:
    https://medium.com/@wesmodes/using-wordpress-insert-pages-plugin-with-your-custom-post-types-and-custom-templates-535c141f9635

    And I noticed that you’re using blade templates (maybe a sage theme?), that might be the source of the problem too. I’ve never tried using this plugin with a Sage theme, which will compile template files and stored them in wp-content/uploads/cache/. So you can either try using one of the compiled templates, or create a template that doesn’t use any blade primitives, just standard php.

    Good luck!

Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘Page not rendering in custom post type using template’ is closed to new replies.