WordPress.org

Forums

Custom Field Suite
[resolved] Adding cfs code to template breaks template (5 posts)

  1. smlombardi
    Member
    Posted 2 years ago #

    As soon as I add ANY cfs related code to my PHP template, the template from that point forward soes not print out. That is, no further html is printed, leaving divs open, sidebar missing, etc.

    Even adding only "php global $cfs" causes this. What am I missing?

    http://wordpress.org/extend/plugins/custom-field-suite/

  2. Matt Gibbs
    Member
    Plugin Author

    Posted 2 years ago #

    Please paste your entire template code to pastebin.com. I need to see your code in order to help diagnose.

  3. smlombardi
    Member
    Posted 2 years ago #

    I discovered that it doesn't work in the default nested-template structure of Twenty Eleven, as in <?php get_template_part( 'content', 'single' ); ?>

    When i put cfs code in content-single.php, I get the errors. However, if I delete that php and move all my content code into the parent single.php it works as advertised.

  4. Matt Gibbs
    Member
    Plugin Author

    Posted 2 years ago #

    Right, templates called using get_template_part don't recognize the $cfs variable, hence the need to add <?php global $cfs; ?> at the top of your file.

  5. smlombardi
    Member
    Posted 2 years ago #

    Yes, but do I add it to the php file that contains get_template_part? If I add it to the template part, I get the error.

Topic Closed

This topic has been closed to new replies.

About this Plugin

  • Custom Field Suite
  • Frequently Asked Questions
  • Support Threads
  • Reviews

About this Topic