Example #1
0
function delibera_wp_list_comments($args = array(), $comments = null)
{
    global $post;
    global $delibera_comments_padrao;
    if (get_post_type($post) == "pauta") {
        $situacao = delibera_get_situacao($post->ID);
        if ($delibera_comments_padrao === true) {
            $args['post_id'] = $post->ID;
            $args['walker'] = new Delibera_Walker_Comment_padrao();
            $comments = get_comments($args);
            $ret = array();
            foreach ($comments as $comment) {
                $tipo_tmp = get_comment_meta($comment->comment_ID, 'delibera_comment_tipo', true);
                if (strlen($tipo_tmp) <= 0 || $tipo_tmp === false) {
                    $ret[] = $comment;
                }
            }
            wp_list_comments($args, $ret);
        } elseif ($situacao->slug == 'validacao') {
            //comment_form();
            $args['walker'] = new Delibera_Walker_Comment();
            //$args['callback'] = 'delibera_comments_list';
            ?>
			<div class="delibera_lista_validacoes">
			<?php 
            wp_list_comments($args, $comments);
            ?>
			</div>
			<?php 
        } elseif ($situacao->slug == 'comresolucao') {
            $args['walker'] = new Delibera_Walker_Comment();
            wp_list_comments($args, $comments);
            $encaminhamentos = delibera_get_comments_encaminhamentos($post->ID);
            $discussoes = delibera_get_comments_discussoes($post->ID);
            ?>
			<div class="delibera_encaminhamentos_inferior">
    			<?php 
            wp_list_comments($args, $encaminhamentos);
            ?>
			</div>
			
			<div id="comments" class="delibera_opinioes_inferior">
			    <hr>
			    <h2 class="comments-title bottom"><?php 
            _e('Histórico da pauta', 'delibera');
            ?>
</h2>
			    <?php 
            wp_list_comments($args, $discussoes);
            ?>
			</div>
			
			<?php 
        } else {
            $args['walker'] = new Delibera_Walker_Comment();
            //$args['callback'] = 'delibera_comments_list';
            wp_list_comments($args, $comments);
        }
    } else {
        wp_list_comments($args, $comments);
    }
}
                }
                ?>
								<?php 
            }
            ?>
							</ul>
						<?php 
        }
        ?>
					</div>
				</div>
			<?php 
    } elseif ($situacao->slug == 'relatoria') {
        $args['walker'] = new Delibera_Walker_Comment();
        $encaminhamentos = delibera_get_comments_all_encaminhamentos($post->ID);
        $discussoes = delibera_get_comments_discussoes($post->ID);
        ?>
				<ol class="commentslist">
					<?php 
        wp_list_comments($args, $encaminhamentos);
        ?>
				</ol>

				<h2 class="comments-title bottom"><?php 
        _e('Discussão sobre a pauta', 'delibera');
        ?>
</h2>
				<ol class="commentslist">
					<?php 
        wp_list_comments($args, $discussoes);
        ?>