WordPress.org

Ready to get started?Download WordPress

Forums

understanding php codes (4 posts)

  1. rusting1927
    Member
    Posted 5 years ago #

    Hi,
    I am trying to learn the workings of a wordpress theme by reverse engineering process :P 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>

    And:

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

  2. Dgold
    Member
    Posted 5 years ago #

    read about The Loop in the Codex

    http://codex.wordpress.org/The_Loop

  3. Chrisber
    Member
    Posted 5 years ago #

    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.

  4. dvsmith
    Member
    Posted 5 years ago #

    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.

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.