I'm developing a Wordpress theme. One of the sections on the front page is titled News. In that section the user should be able to insert information himself (I'll make a separate file called news.php which will php included into the markup), but I also want the content to be automatically updated once the user makes a post.
For example, if the user writes a new post, I want the news section to be automatically updated to something like this:
A new post was written, find it here (where 'here' is a hyperlink pointing to the url of the post).
edit Let me try to give a little more details so it's clearer. The news section will be an unordered list. Thus:
<ul>
<li>
News item 1
</li>
<li>
News item 2
</li>
</ul>
I want the user to be able to add content to the news section, aka make new News Items, but using the visual editor of Wordpress such that the user doesn't have to understand the code and doesn't have to copy/paste the LIs.
Furthermore, whenever a new post is published, I want it to show up as:
"new post published, find it here" where 'here' is a hyperlink with linking to the post.
Is this possible to accomplish?
Thanks, Amit
If i correctly understood, you need write something like this:
<?php
query_posts(array('posts_per_page' => 1));
the_post();
?>
A new post was written, find it <a href="<?php echo the_permalink();?>">here</a>
Latest news list
<?php
query_posts(array('posts_per_page' => 6));
?>
<ul>
<?php $count=0; if (have_posts()) : while (have_posts()) : the_post(); ?>
<li><a href="<?php echo the_permalink(); ?>"><?php the_title(); ?></a></li>
<?php endwhile; endif; ?>
</ul>