How do I preserve WP content formatting while integrating into my existing site?
-
Hello!
I am integrating WordPress into my professional portfolio. So, I have created a home.php page for my blog that uses the same styling as the rest of my portfolio. I am in the process of styling, and I have created many dummy blog posts with paragraphs of lorem ipsum text. Unfortunately, I noticed that the line breaks between these paragraphs do not appear in my web page.
My question: how do I guarantee that my posts’ formatting appears on my blog as it was originally input in WordPress? (Particularly for line breaks. I will also be looking to add SlideShares in the future too.)
Below is “The Loop” for my blog posts on my home.php page.
<?php // for each post, while ( have_posts() ) : the_post(); // get everything $id = get_the_ID(); $title = get_the_title(); $time = get_the_time('F jS, Y'); $content = get_the_content(); // post title echo '<a id="post-' . $id . '" class="postTitle" style="font-size: 300%;" href="https://blog.myportfolio.com/#post-' . $id . '">' . $title . '</a>'; // post subtitle echo '<p class="subtitle">' . $time . " by Nathan Wireds</p>"; // problem: content format changes from when it's input into wordpress. // for example, there are no paragraph spaces! it's just a wall of text echo '<p>' . $content . '</p>'; // comments pop-up. change it to be on the page? ajax? how? echo '<p>'; echo comments_popup_link('No Comments ?', '1 Comment ?', '% Comments ?'); echo '</p>'; echo "<hr/>"; endwhile; ?>
- The topic ‘How do I preserve WP content formatting while integrating into my existing site?’ is closed to new replies.