Title: Post PHP Code for wesite template
Last modified: August 21, 2016

---

# Post PHP Code for wesite template

 *  [richard.harris](https://wordpress.org/support/users/richardharris/)
 * (@richardharris)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/post-php-code-for-wesite-template/)
 * I am converting a HTML site into wordpress and I seem to have the most of it 
   sorted. However I need my user to be able to update 3 blocks of text on the home
   page and I would like to be able to control these through the post section of
   wordpress if possible. I have the following code I am using for the content. 
   Is there a call I need to make for to be able to make these sections editable
   with posts?
 * <?php if (have_posts()) : while (have_posts()) : the_post(); ?> <h1><?php the_title();?
   ></h1> <?php the_content(); ?> <?php endwhile; endif; ?>

Viewing 2 replies - 1 through 2 (of 2 total)

 *  [Trisha Salas](https://wordpress.org/support/users/trishasalas/)
 * (@trishasalas)
 * [12 years, 8 months ago](https://wordpress.org/support/topic/post-php-code-for-wesite-template/#post-4217350)
 * Richard,
 * Take a look at wp_query, you would have to be somewhat specific about either 
   category. This page will tell you everything you need to know about wp_query 
   => [http://codex.wordpress.org/Class_Reference/WP_Query](http://codex.wordpress.org/Class_Reference/WP_Query)
 * One example is to query by category and call a single post so that the latest
   post is always the one visible in the content box you are targeting.
 *     ```
       <?php 
   
       	$query = new WP_Query( array(
       			'posts_per_page'	=>	1,
       			'category' => 'movies'
       			));?>
   
       			<?php while ( $query->have_posts() ) : $query->the_post();?>
   
       			<?php the_title(); ?>
   
                   <?php the_content(); ?>
   
                   <?php endwhile;?>
       ```
   
 * Hope this helps. You will probably need to do a query like this for each of the
   3 blocks of text on the page.
 *  Thread Starter [richard.harris](https://wordpress.org/support/users/richardharris/)
 * (@richardharris)
 * [12 years, 7 months ago](https://wordpress.org/support/topic/post-php-code-for-wesite-template/#post-4217644)
 * I will give it a go 🙂
 * Richard
 * N Ireland

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Post PHP Code for wesite template’ is closed to new replies.

 * 2 replies
 * 2 participants
 * Last reply from: [richard.harris](https://wordpress.org/support/users/richardharris/)
 * Last activity: [12 years, 7 months ago](https://wordpress.org/support/topic/post-php-code-for-wesite-template/#post-4217644)
 * Status: not resolved

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
