WordPress.org

Support

Support » How-To and Troubleshooting » [Resolved] Checking value of meta data and returning post differently styled

[Resolved] Checking value of meta data and returning post differently styled

  • I’m running (or rather, trying) the following script to check whether the meta data “full” has a value and return the post’s content differently.

    <?php if (have_posts()) :
        while (have_posts()) : the_post();
             $customField = get_post_custom_values("full");
           	 if (isset($customField[0])) {
                  //Custom field is set, display a full post
                  the_title();
                  the_content();
             } else {
                  // No custom field set, let's display an excerpt
                  the_title();
                  the_excerpt();
        endwhile;
    endif;
    ?>

    However, this generates the following error and I can’t seem to figure out why. I’m having a hard time understanding why.

    Parse error: parse error, unexpected T_ENDWHILE

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)
  • The topic ‘[Resolved] Checking value of meta data and returning post differently styled’ is closed to new replies.