Hey kdbates!
Haha, sorry let me explain what’s goin on here!
The method I was using I learned from this page:
https://codex.www.ads-software.com/Function_Reference/get_post
This is just one method to get a specific post’s content. I set the post’s id to a variable using $contact_id = 73 (73 being the id of the contact page) and then pass the id to the get_post() function. You can’t pass the value 73 by itself, it must be within a variable which is why I set it to the $contact_id variable. Next I put the results of the get_post() into a variable called $contact_post_id. Finally I access the property “post_title” and “post_id” from the post object that is returned to the $contact_post_id variable. Now I’ve got a variable called $title containing the post’s title and $content containing the content.
Not sure if that’s what you wanted to know, but thought I’d include it just in case. Now the important part:
When you use the_content() function to show a post or page’s content, the content receives formatting, aka the paragraph tags and such that I was hoping for. Since I didn’t end up using the_content() function, I was losing this formatting. Once I realized this, I opted for a different method of getting the content for the post. The method I used instead was the query_posts() function. Here’s all of the nitty gritty about this function:
https://codex.www.ads-software.com/Function_Reference/query_posts
On a specific wordpress page (such as an “about” page, for example) there is this piece of code:
<?php if(have_posts()) : ?><?php while(have_posts()) : the_post(); ?>
and further down in the page.php code you’ll see
<?php the_content(); ?>
This will take the content from whatever page you’re surfing. So if you’re on the About page, the content will be pulled from whatever is typed in the WYSIWYG editor on the about page editor. Using query_posts(), you’re telling wordpress to look at a different page than the one your surfing. I ended up using this code:
<?php
//The Query
query_posts('page_id=73&posts_per_page=-1');
//The Loop
if ( have_posts() ) : while ( have_posts() ) : the_post(); ?>
<li id="contact_div" class="invis post section">
<div id="contact_content" class="section_content">
<h4><?php the_title(); ?></h4>
<?php the_content(); ?>
</div>
</li>
<?php endwhile; ?>
<?php endif; ?>
<?php wp_reset_query(); ?>
So now, because of the query_posts() function, when I call “the_content();” I am actually pulling the content from the page with the id of 73 instead of the page I’m currently on. So I am able to pull in content from another page and because I am using the_content(); function, the formatting (each line wrapped in paragraph tags) remains and looks the way I typed it in in the WYSIWYG editor.
Ok I hope this explanation wasn’t totally over-detailed but I thought I’d try to be extra thorough ??
Hope this helps ??