For SEO or Instructions to Users
Wordpress offers some built-in functions & queries, and filters (functions that modify the output or styling of a custom query).
One I just started using today allows me to put into my index page template a specific "post" of text with all of the formatting available in the Posts editor.
Significance: for my test Classipress (this will work on any other Appthemes theme) on the home page I wanted some nicely styled text to explain what the site is about in the left hand column just above the Category Tabs.
And I wanted to be able to come back in later and go to the Wordpress Posts editor and edit that text now and then, even include images.
AND, I did NOT want to make it look like a typical blog post with Author, Date, etc...
I just wanted the Post title and the text with its formatting between <p> and </p>
----- clean and simple so that if the Title is rendered with <H3> tags that is what I get and nothing more.
So, I went to Add a new Post--wrote the text with a header and simple paragraph formatting and saved it as PRIVATE so that it would not show up unexpectedly anywhere.
I added "front_page" as a new post category assigned to this post for other uses later. But really for this example all you need to do is to create the Post and then note the NUMBER of the post in the editor url.
I saw that my post was "2892"
In my index.php I put the following code
Code:
<?php
$post_id = 2892;
$queried_post = get_post($post_id);
$content = $queried_post->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
echo $content;
?>
<div class="clr"></div>
In this example I show that I placed this code just after <div class="content_left"> --
and I show at the bottom that
this code ends just before the <div class="tabcontrol">
PHP Code:
<div class="content_left">
<?php
$post_id = 2892;
$queried_post = get_post($post_id);
$content = $queried_post->post_content;
$content = apply_filters('the_content', $content);
$content = str_replace(']]>', ']]>', $content);
echo $content;
?>
<div class="clr"></div>
<div class="tabcontrol">
The "apply_filters" does NOT require the Appthemes LOOP.php.
I get sweet and simple html code on the page output that conforms to the div containers it is output to.
And it automatically pushes down the TABS in that column just enough to give its message. If in the Post itself you added LINKS or IMAGES those would be included as well.
This is a neat Wordpress snippet of code that will go anywhere in an Appthemes template including the head.php, index.php, page.php....sidebars.....
You write whatever number of different posts with custom instructions or messages, Save them as PRIVATE, note the id number of each and drop this code inside column or post divs with the specific post id you wish to reference.
And any time you want to change the message or re-style it or add images or even videos you just go to the Post editor and edit that particular post to change the clean html that is displayed on your different Appthemes pages.
I am using this for clarity and
SEO purposes.