Viewing 5 replies - 1 through 5 (of 5 total)
  • david.bailey

    (@davidbailey-1)

    WordPress already creates specific classes for post IDs, page types, and even whether the page is even or odd. You should be able to see the source or inspect the element using firebug. You should be able to style the theme accordingly using your style.css file

    Thread Starter Mr-Cute

    (@mr-cute)

    i really don’t know how any tutorial ?
    or anyone can update this code to display
    first li
    <li><div class="writers"><span class="article_title">
    and second li
    <li><div class="writers1"><span class="article_title">

    david.bailey

    (@davidbailey-1)

    In the foreach you could probably create an increment to produce those classes. For example:

    $count = 0;
    foreach ( $var as $v ){
         //Increment each iteration
         $count++;
         $output_buffer .= '<li><div class="writers' . $count  . '"><span class="article_title">';
    }

    Something like that should work.

    Thread Starter Mr-Cute

    (@mr-cute)

    oups i guess you understand me wrong

    the final output would be

    [code moderated - please use the pastebin]

    sorry for bothering

    david.bailey

    (@davidbailey-1)

    You should probably try it out first. It adds a value of 1 to the variable $count for each post in the array.

Viewing 5 replies - 1 through 5 (of 5 total)
  • The topic ‘2 div style for Each Post’ is closed to new replies.