• Resolved amatsuki

    (@amatsuki)


    Here on this paste bin: https://pastebin.com/AC1fPwnz is my template for my front page. But I can’t get $content = get_the_content to print out when I do so like this:

    echo $content; down on line 80.

    I am totally lost. I feel like I”m not “in the loop” but I’ve got no idea how to get back in the loop. Help?

    If I try to print out <?php if (have_posts()) : while (have_posts()) : the_post(); ?> for a second time on the page, nothing happens except error messages.

    Any help would be awesome.

Viewing 5 replies - 1 through 5 (of 5 total)
  • What error messages you see?

    Thread Starter amatsuki

    (@amatsuki)

    If I bring down the <?php if (have_posts()) : while (have_posts()) : the_post(); ?> on the page, above the second wp_query, I get this error: Parse error: syntax error, unexpected $end in /this directory/ on my computer/wp-content/themes/html5blank-master/front-page.php on line 110

    can you describe what you are trying to achieve with your code?

    where did you define $pages which is used in line 67:
    foreach ($pages as $page) {

    possibly try to get some debug information by reviewing https://codex.www.ads-software.com/Debugging_in_WordPress

    Seems like you have one extra loop try removing the first if (have_posts and the endwhile;

    Thread Starter amatsuki

    (@amatsuki)

    Ok I think I fixed the issue. I think I did have an extra loop or something going on. I didn’t need the foreach statement I thought I did. I am themeing with foundation and thought I needed a foreach to ensure that the classes got around each element. Anyway, here is my revised page; https://pastebin.com/eRam8QeM It works, however am I using
    <?php wp_reset_postdata();?> properly? I wanted to make an if else statment with my last wp_query, so that incase the wp_query failed I could show some static text. But doing this at the very end of the page, results in syntax errors that I don’t understand.

    <?php endwhile; ?>
    <?php wp_reset_postdata();?>
    <?php endwhile; else: ?>
    <?php endif ?>

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘I can't get the_content() to work!’ is closed to new replies.