PHP background rotate

Gestart doorShahiem1 reacties29 weergaven

2 berichten · pagina 1 van 1

Shahiem

Lid · Topicstarter

Berichten
20.364
Reputatie
0
Punten
0,00
Lid sinds
Laatst gezien
Hi,

Ik ben voor Patrick bezig om zijn Wordpress site goed te krijgen. Nu wil ik bij de comment functie dat je bijvoorbeeld dit krijgt:

wit
zwart
wit
zwart

Maar ik heb geen idee hoe ik dat hier voor elkaar ga krijgen. Wie zou mij kunnen helpen?

Alvast bedankt!

Code

function twentyten_comment( $comment, $args, $depth ) {
    $GLOBALS[comment] = $comment;
    $comments_count = wp_count_comments(get_the_ID());
    
    switch ( $comment->comment_type ) :
        case  :
    ?>
    <div id="comment-[COLOR= #0000BB]<?php[/COLOR] comment_ID[COLOR= #007700]();[/COLOR] ?>">
        <div style="float: left; width: 80px;">
            [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] get_avatar[COLOR= #007700]([/COLOR] [COLOR= #0000BB]$comment[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #0000BB]40[/COLOR] [COLOR= #007700]);[/COLOR] ?>
        </div>
        <div style="float: left; width: 530px; background: #[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$comments_count[/COLOR] [COLOR= #007700]%[/COLOR] [COLOR= #0000BB]2[/COLOR] [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]c55a45[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000]be452e[/COLOR][COLOR= #007700]);[/COLOR] ?>; border: 1px solid #000; padding: 10px; -webkit-border-radius: 5px;
-moz-border-radius: 5px;
border-radius: 5px;">
            <div class="comment-author vcard">
                
                [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/printf"]printf[/URL][COLOR= #007700]([/COLOR] __[COLOR= #007700]([/COLOR] [COLOR= #DD0000]<strong>%s <span class="says">schreef</span> op</strong>[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]twentyten[/COLOR] [COLOR= #007700]),[/COLOR] [URL="http://www.php.net/sprintf"]sprintf[/URL][COLOR= #007700]([/COLOR] [COLOR= #DD0000]<cite class="fn">%s</cite>[/COLOR][COLOR= #007700],[/COLOR] get_comment_author_link[COLOR= #007700]() ) );[/COLOR] ?>
                [COLOR= #0000BB]<?php[/COLOR]
                    [COLOR= #FF8000]/* translators: 1: date, 2: time */[/COLOR]
                    [URL="http://www.php.net/printf"]printf[/URL][COLOR= #007700]([/COLOR] __[COLOR= #007700]([/COLOR] [COLOR= #DD0000]<strong>%1$s om %2$s</strong>[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]twentyten[/COLOR] [COLOR= #007700]),[/COLOR] get_comment_date[COLOR= #007700](),[/COLOR]  get_comment_time[COLOR= #007700]() );[/COLOR] ?></a>[COLOR= #0000BB]<?php[/COLOR] edit_comment_link[COLOR= #007700]([/COLOR] __[COLOR= #007700]([/COLOR] [COLOR= #DD0000](Edit)[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]twentyten[/COLOR] [COLOR= #007700]),[/COLOR] [COLOR= #DD0000] [/COLOR] [COLOR= #007700]);[/COLOR]
                ?>
                <div class="reply">
                [COLOR= #0000BB]<?php[/COLOR] comment_reply_link[COLOR= #007700]([/COLOR] [URL="http://www.php.net/array_merge"]array_merge[/URL][COLOR= #007700]([/COLOR] [COLOR= #0000BB]$args[/COLOR][COLOR= #007700],[/COLOR] [URL="http://www.php.net/array"]array[/URL][COLOR= #007700]([/COLOR] [COLOR= #DD0000]depth[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]$depth[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]max_depth[/COLOR] [COLOR= #007700]=>[/COLOR] [COLOR= #0000BB]$args[/COLOR][COLOR= #007700][[/COLOR][COLOR= #DD0000]max_depth[/COLOR][COLOR= #007700]] ) ) );[/COLOR] ?>
            </div><!-- .reply -->
            </div><!-- .comment-author .vcard -->
            [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/if"]if[/URL] [COLOR= #007700]([/COLOR] [COLOR= #0000BB]$comment[/COLOR][COLOR= #007700]->[/COLOR]comment_approved [COLOR= #007700]==[/COLOR] [COLOR= #DD0000]0[/COLOR] [COLOR= #007700]) :[/COLOR] ?>
                <em class="comment-awaiting-moderation">[COLOR= #0000BB]<?php[/COLOR] _e[COLOR= #007700]([/COLOR] [COLOR= #DD0000]Your comment is awaiting moderation.[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]twentyten[/COLOR] [COLOR= #007700]);[/COLOR] ?></em>
                <br />
            [COLOR= #0000BB]<?php[/COLOR] [COLOR= #007700]endif;[/COLOR] ?>

            <div class="comment-meta commentmetadata"><a href="[COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] esc_url[COLOR= #007700]([/COLOR] get_comment_link[COLOR= #007700]([/COLOR] [COLOR= #0000BB]$comment[/COLOR][COLOR= #007700]->[/COLOR]comment_ID [COLOR= #007700]) );[/COLOR] ?>"></a>
                
            </div><!-- .comment-meta .commentmetadata -->
            
            <div class="comment-body">[COLOR= #0000BB]<?php[/COLOR] comment_text[COLOR= #007700]();[/COLOR] ?> [COLOR= #0000BB]<?php[/COLOR] [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #007700]([/COLOR][COLOR= #0000BB]$comments_count[/COLOR] [COLOR= #007700]%[/COLOR] [COLOR= #0000BB]2[/COLOR] [COLOR= #007700]?[/COLOR] [COLOR= #DD0000]c55a45[/COLOR] [COLOR= #007700]:[/COLOR] [COLOR= #DD0000]be452e[/COLOR][COLOR= #007700]);[/COLOR] ?>
            </div>
        </div>
        <div class="clear"></div>
    </div><!-- #comment-##  -->
<div class="clear"></div><br /><br />
    [COLOR= #0000BB]<?php[/COLOR]
            [URL="http://www.php.net/break"]break[/URL][COLOR= #007700];
        case[/COLOR] [COLOR= #DD0000]pingback[/COLOR]  [COLOR= #007700]:
        case[/COLOR] [COLOR= #DD0000]trackback[/COLOR] [COLOR= #007700]:[/COLOR]
    ?>
    <li class="post pingback">
        <p>[COLOR= #0000BB]<?php[/COLOR] _e[COLOR= #007700]([/COLOR] [COLOR= #DD0000]Pingback:[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]twentyten[/COLOR] [COLOR= #007700]);[/COLOR] ?> [COLOR= #0000BB]<?php[/COLOR] comment_author_link[COLOR= #007700]();[/COLOR] ?>[COLOR= #0000BB]<?php[/COLOR] edit_comment_link[COLOR= #007700]([/COLOR] __[COLOR= #007700]([/COLOR] [COLOR= #DD0000](Edit)[/COLOR][COLOR= #007700],[/COLOR] [COLOR= #DD0000]twentyten[/COLOR] [COLOR= #007700]),[/COLOR] [COLOR= #DD0000] [/COLOR] [COLOR= #007700]);[/COLOR] ?></p>
    [COLOR= #0000BB]<?php[/COLOR]
            [URL="http://www.php.net/break"]break[/URL][COLOR= #007700];
    endswitch;
}
endif;[/COLOR]
0
Rik

Lid

Berichten
18.393
Reputatie
0
Punten
0,04
Lid sinds
Laatst gezien
Ik weet niet precies hoe je het in de functie krijgt, maar:

[COLOR= #0000BB]<?php
$i[/COLOR] [COLOR= #007700]=[/COLOR] [COLOR= #0000BB]1[/COLOR][COLOR= #007700];[/COLOR]

[URL="http://www.php.net/while"]while[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$iets[/COLOR] [COLOR= #007700]=[/COLOR] fetch[COLOR= #007700]([/COLOR][COLOR= #0000BB]$eenquery[/COLOR][COLOR= #007700]))
{[/COLOR]
    [URL="http://www.php.net/if"]if[/URL][COLOR= #007700]([/COLOR][COLOR= #0000BB]$i[/COLOR] [COLOR= #007700]%[/COLOR] [COLOR= #0000BB]2[/COLOR] [COLOR= #007700]==[/COLOR] [COLOR= #0000BB]0[/COLOR][COLOR= #007700]) 
    {[/COLOR] 
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]wit[/COLOR][COLOR= #007700]; 
    }[/COLOR]
    [URL="http://www.php.net/else"]else[/URL] 
    [COLOR= #007700]{[/COLOR]
        [URL="http://www.php.net/echo"]echo[/URL] [COLOR= #DD0000]zwart[/COLOR][COLOR= #007700];
    }[/COLOR]

    [COLOR= #0000BB]$i[/COLOR][COLOR= #007700]++;
}[/COLOR]
?>
0

Jouw reactie

Deel je idee, stel een vraag of help een ander verder.

Editor laden…

Praat mee met de One2xs-community.

Inloggen om te reageren