Este é um post de José Lopes.
Este plugin possibilita a escolha de um número máximo de comentários por artigo (post) que
ficará visível. Fornece ainda um link que expande a lista de comentários mostrando-os todos.
Posted by José Lopes.
This plugin enables the setting of a maximum number of comments allowed to display
in each post. In addition, it provides a link to expand the comments showing all the remaining ones.
O problema com muitos comentários foi colocado nos comentários ao plugin
Hide or Show Comments,
em que se questionava a possibilidade de mostrar somente alguns comentários mas também de mostrar
a lista completa por intermédio de um link, à semelhança do plugin mencionado.
Embora esta funcionalidade possa ser implementada alterando o PHP do ficheiro comments.php do
Theme decidi fazer este plugin para facilitar.
Download
Pode fazer o download de um dos ficheiros:
Também pode obter este Plugin no reportório do Wordpress em
Maximum Number of Comments.
Instalação
- Descomprimir o ficheiro para a directoria /wp-content/plugins/.
- Confirmar que o conteúdo do plugin está na directoria maximum-number-of-comments.
- Activar o plugin pelo painel administrativo do Wordpress.
- Editar o ficheiro comments.php do Theme do site.
- Apagar o bloco de texto que começa e acaba com:
<?php if ($comments) : ?>
...
...
<?php endif; ?>
- Escrever no seu lugar:
<?php MaximumComments(2, $comments, $oddcomment) ?>
Onde:
- O número 2 representa o número máximo de comentários a serem mostrados (pode por o valor que quiser)
- A constante $comments é definida no sistema pelo que não deve ser mudada.
- A constante $oddcomment se não aparecer algures no ficheiro comments.php deve no seu lugar ser
escrito 'alt', caso contrário não alterar.
Nota final
Este plugin é perfeitamente compatível com o plugin
Hide or Show Comments.
The problem of posts with many comments was placed to the plugin
Hide or Show Comments
comments, where it was asked the possibility of showing only some comments with a link to show
the remaining list, like the plugin Hide or Show Comments
feature.
Though this funcionality may be implemented by changing and adding code to the PHP file comments.php, I find
that a new plugin would help more.
Download
You can download one of the files that serves you better:
You may also find this Plugin in the Wordpress repository at
Maximum Number of Comments.
Installation
- Decompress the files to the /wp-content/plugins/ directory.
- Confirm that the plugin content is on the directory maximum-number-of-comments.
- Activate the plugin through the administrative pannel in WordPress.
- Edit the comments.php file of your site Theme.
- Delete the comment block starting and ending with:
<?php if ($comments) : ?>
...
...
<?php endif; ?>
- Write in its place:
<?php MaximumComments(2, $comments, $oddcomment) ?>
where:
- The number 2 represents the maximum number of comments to be shown (it can be whatever you want)
- The constant $comments is defined on the system so do not change it.
- The constant $oddcomment if it doesn't appears on the file comments.php just write in its place 'alt',
else leave it like that.
Final note
This plugin can be also used, with no problem, combined with the plugin
Hide or Show Comments.
Wonderful plugin. But I have a suggestion which I'm you can do easily as a separate plugin or within this same one.
How about putting a limit to the number of posts users (based on their access level preferably) are allowed to post every day/week/month?
I've been looking for such plugin for ages and never found one. But I'm sure a lot of collective blogs would appreciate it.
What do you think, man?
Cheers,