• Resolved xroox

    (@xroox)


    Hi!

    I created a custom post type successfully, however there is only a title on my posts on the front end, no body content (it is there in the editor)!

    Also, I did not check ‘featured image’ under the Supports section, but there is still a placeholder image where the featured image would be.

    Not sure how to proceed, hoping someone could steer me in the right direction.

    Here’s an example of a post: (link below)
    Thanks much!

    • This topic was modified 4 years, 9 months ago by Yui. Reason: There is special field for links

    The page I need help with: [log in to see the link]

Viewing 3 replies - 1 through 3 (of 3 total)
  • Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Hard for me to say what may be going on as i don’t have any way to see the single.php template being used. It’s going to be theme/template based at this point, as CPTUI doesn’t interact with that in any direct means.

    If you pastebin.com your single.php I could probably get some more ideas, or need some extra template files afterwards, but until then, I’m not much help.

    Thread Starter xroox

    (@xroox)

    Thanks ok.

    Here is the actual single.php file (not much to it):

    <?php get_template_part('templates/content/content-single', get_post_type()); ?>

    And here is the contents of content-single.php: https://pastebin.com/ZBTZeCsw

    Thanks for your help. ??

    Plugin Contributor Michael Beckwith

    (@tw2113)

    The BenchPresser

    Regarding the featured image part, it looks like the single template is absolutely expecting a featured image to be used. It’s fetching that information on line 5 and then checking if it got anything, and if not, setting the image to be a placeholder.

    Not sure what is providing wp_display_component but it’s constructing a list of arguments to pass in to a blocks/page_header.php and blocks/flexible_content_block.php template files. The usage of get_field() tells me that it’s using Advanced Custom Fields.

    Probable that you don’t have the right parts set up from ACF to render for the editor, as compared to standard posts. That said, if part of this task was on my plate, I’d probably end up creating a single-my_post_type.php and start customizing from there as needed, to still match up fairly well, but at the same time not.

    Most specifically around line 68-70 where it’s expecting the ACF content instead of a standard WordPress loop with displaying things like the_content() etc.

    Alternatively you could check your ACF settings and get the field types displaying in more places, like this new post type you have going on, and make use of those fields for this.

Viewing 3 replies - 1 through 3 (of 3 total)
  • The topic ‘Post body content not displaying on front end’ is closed to new replies.