comments_popup_link [ WordPress Function ]
comments_popup_link ( $zero = false, $one = false, $more = false, $css_class = '', $none = false )
| Parameters: |
|
| Uses: |
|
| Returns: |
|
| Defined at: |
|
Soorgelijke functies: comments_link, comments_popup_script, is_comments_popup, comments_rss_link, comment_link
Displays the link to the comments popup window for the current post ID.
Is not meant to be displayed on single posts and pages. Should be used on the lists of posts
Source
<?php
function comments_popup_link( $zero = false, $one = false, $more = false, $css_class = '', $none = false ) {
global $wpcommentspopupfile, $wpcommentsjavascript;
$id = get_the_ID();
if ( false === $zero ) $zero = __( 'No Comments' );
if ( false === $one ) $one = __( '1 Comment' );
if ( false === $more ) $more = __( '% Comments' );
if ( false === $none ) $none = __( 'Comments Off' );
$number = get_comments_number( $id );
if ( 0 == $number && !comments_open() && !pings_open() ) {
echo '<span' . ((!empty($css_class)) ? ' class="' . esc_attr( $css_class ) . '"' : '') . '>' . $none . '</span>';
return;
}
if ( post_password_required() ) {
echo __('Enter your password to view comments.');
return;
}
echo '<a href="';
if ( $wpcommentsjavascript ) {
if ( empty( $wpcommentspopupfile ) )
$home = home_url();
else
$home = get_option('siteurl');
echo $home . '/' . $wpcommentspopupfile . '?comments_popup=' . $id;
echo '" onclick="wpopen(this.href); return false"';
} else { // if comments_popup_script() is not in the template, display simple comment link
if ( 0 == $number )
echo get_permalink() . '#respond';
else
comments_link();
echo '"';
}
if ( !empty( $css_class ) ) {
echo ' class="'.$css_class.'" ';
}
$title = the_title_attribute( array('echo' => 0 ) );
echo apply_filters( 'comments_popup_link_attributes', '' );
echo ' title="' . esc_attr( sprintf( __('Comment on %s'), $title ) ) . '">';
comments_number( $zero, $one, $more );
echo '</a>';
}
?>
Examples [ wp-snippets.com ]
Top Google zoekresultaten
- comments_popup_link - WordPress Codex
Description. Displays a link to the comments popup window if comments_popup_script() is used, otherwise it displays a normal link to comments. This tag must ...
codex.wordpress.org - WordPress › Support » Tags — comments_popup_link
WordPress › Support » comments_popup_link. 12Next ... comments-template. php function comments_popup_link() parameters explanation, 2, esmi, 12 months ...
wordpress.org - comments - Loop not displaying comments_popup_link - WordPress ...
Feb 26, 2012 ... I cannot get the comments_popup_link to display with the posts retrieved by the foreach loop. Only the title and permalink are displayed.
wordpress.stackexchange.com - comments_popup_link « bbPress Support Forums
i'm looking for a way to use the same output like in wp for the comments like: <? php comments_popup_link('no comments', 'one comment', ...
bbpress.org
Gebruikersdiscussies [ wordpress.org ]
- gregmathes on "K2 comments display text is unmodifiable"
- Rodni on "How do I change the color of my Comment Link"
- drewdroid on "How do I change the color of my Comment Link"
- Rodni on "How do I change the color of my Comment Link"
- Rodni on "How do I change the color of my Comment Link"
- jrav001 on "How do I change the color of my Comment Link"
- Rodni on "How do I change the color of my Comment Link"
- drewdroid on "How do I change the color of my Comment Link"
- Rodni on "How do I change the color of my Comment Link"
- drewdroid on "How do I change the color of my Comment Link"