Support » Themes and Templates » 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>” rel=”bookmark” title=”Permanent Link to <?php the_title_attribute(); ?>”><?php the_title(); ?></h2>



    <div id=”annoucementcontent”>

    <?php the_excerpt_extra(); ?>…. /?p=<?php the_ID(); ?>#more-<?php the_ID(); ?>”>[Read More]

    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 how do i know which box is used to display which category?

Viewing 3 replies - 1 through 3 (of 3 total)
  • read about The Loop in the Codex

    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.

    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.