Title: understanding php codes
Last modified: August 19, 2016

---

# understanding php codes

 *  [rusting1927](https://wordpress.org/support/users/rusting1927/)
 * (@rusting1927)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/understanding-php-codes/)
 * Hi,
    I am trying to learn the workings of a wordpress theme by reverse engineering
   process 😛 and hope to learn at least a minimum amount so that i will be able
   to edit my current themes. I have downloaded a number of themes and using the
   class and id names to work out the php codes. In one of the themes (i think its
   simple magazine) i found the following code:
 * <?php if (have_posts()) : ?>
 *  <?php while (have_posts()) : the_post(); ?>
 *  <?php if(is_announcement()): ?>
 *  <div id=”annoucement”>
 *  <div id=”annoucementtitle”>
 * </h2>
 *  </div>
 * And:
 * <div id=”annoucementcontent”>
 * 
 * While i think the first code is to get the big box of a single post content, 
   the second one is to get a smaller content box showing a post for a specific 
   category (at least thats how it was displayed in the demo). I have two questions…
   am i right with my thinking? And there is no category name/id inside the code..
   so how do i know which box is used to display which category?

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

 *  [Dgold](https://wordpress.org/support/users/dgold/)
 * (@dgold)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/understanding-php-codes/#post-851043)
 * read about The Loop in the Codex
 * [http://codex.wordpress.org/The_Loop](http://codex.wordpress.org/The_Loop)
 *  [Chrisber](https://wordpress.org/support/users/chrisber/)
 * (@chrisber)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/understanding-php-codes/#post-851045)
 * The only thing that php is doing is calling information from your database. Where
   and how it is displayed is conrolled by xhtml and css.
 *  [dvsmith](https://wordpress.org/support/users/dvsmith/)
 * (@dvsmith)
 * [17 years, 8 months ago](https://wordpress.org/support/topic/understanding-php-codes/#post-851059)
 * Anything that’s not between `<?php` and `?>` is not PHP code, it’s (X)HTML.
 * The `id` and `class` attributes in the HTML are calls to the CSS stylesheets.
   They’re completely arbitrary, so long as the names match those on the stylesheet.
   You could rename every instance of `#annoucementcontent` to `#joe-bob` and every
   instance of `#annoucement` to `#angelina-jolie` and it wouldn’t affect the Loop,
   at all.

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

The topic ‘understanding php codes’ is closed to new replies.

 * 3 replies
 * 4 participants
 * Last reply from: [dvsmith](https://wordpress.org/support/users/dvsmith/)
 * Last activity: [17 years, 8 months ago](https://wordpress.org/support/topic/understanding-php-codes/#post-851059)
 * Status: not a support question

## Topics

### Topics with no replies

### Non-support topics

### Resolved topics

### Unresolved topics

### All topics
