Skip to main content
added 6 characters in body
Source Link
Simon
  • 1.2k
  • 7
  • 10

The problem is that you are echoing inside a string concatenation. Think of echo as something that will always begin on a new line. In most cases it's wisest to perform any calculations or string concatenations and store the result in a variable, and thethen call echo $var; on the following line.

In this particular case though we are dealing with a WordPress core function (comments_popup_link()) that does the echoing for us. This will probably work:

<span class="comment_meta">With: </span><?php comments_popup_link(
    '', // No comments exist, you would probably want to display a link here in order for people to add the first comment
    '1 comment', // 1 comment, usually phrased differently
    '% comments' // > 1 comment
); ?>

If you don't want to display the "With:" label in case there are no comments you could just put it inside an if statement. I think thismight work:

<span class="comment_meta"><?php if (wp_count_comments(get_the_ID())) : ?>With: <?php endif; ?></span>

The problem is that you are echoing inside a string concatenation. Think of echo as something that will always begin on a new line. In most cases it's wisest to perform any calculations or string concatenations and store the result in a variable, and the echo $var; on the following line.

In this particular case though we are dealing with a WordPress core function (comments_popup_link()) that does the echoing for us. This will probably work:

<span class="comment_meta">With: </span><?php comments_popup_link(
    '', // No comments exist, you would probably want to display a link here in order for people to add the first comment
    '1 comment', // 1 comment, usually phrased differently
    '% comments' // > 1 comment
); ?>

If you don't want to display the "With:" label in case there are no comments you could just put it inside an if statement. I think thismight work:

<span class="comment_meta"><?php if (wp_count_comments(get_the_ID())) : ?>With: <?php endif; ?></span>

The problem is that you are echoing inside a string concatenation. Think of echo as something that will always begin on a new line. In most cases it's wisest to perform any calculations or string concatenations and store the result in a variable, and then call echo $var; on the following line.

In this particular case though we are dealing with a WordPress core function (comments_popup_link()) that does the echoing for us. This will probably work:

<span class="comment_meta">With: </span><?php comments_popup_link(
    '', // No comments exist, you would probably want to display a link here in order for people to add the first comment
    '1 comment', // 1 comment, usually phrased differently
    '% comments' // > 1 comment
); ?>

If you don't want to display the "With:" label in case there are no comments you could just put it inside an if statement. I think thismight work:

<span class="comment_meta"><?php if (wp_count_comments(get_the_ID())) : ?>With: <?php endif; ?></span>
added 1 characters in body
Source Link
Simon
  • 1.2k
  • 7
  • 10

The problem is that you are echoing inside a string concatenation. Think of echo as something that will always begin on a new line. In most cases it's wisest to perform any calculations or string concatenations and store the result in a variable, and the echo $var; on the following line.

In this particular case though we are dealing with a WordPress core function (comments_popup_link()) that does the echoing for us. This will probably work:

<span class="comment_meta">With: </span><?php comments_popup_link(
    '', // No comments exist, you would probably want to display a link here in order for people to add the first comment
    '1 comment', // 1 comment, usually phrased differently
    '% comments' // > 1 comment
); ?>

If you don't want to display the "With:" label in case there are no comments you could just put it inside an if statement. I think thismight work:

<span class="comment_meta"><?php if (wp_count_comments(get_the_ID())) : ?>With: <?php endif; ?></span>

The problem is that you are echoing inside a string concatenation. Think of echo as something that will always begin on a new line. In most cases it's wisest to perform any calculations or string concatenations and store the result in a variable, and the echo $var; on the following line.

In this particular case though we are dealing with a WordPress core function (comments_popup_link()) that does the echoing for us. This will probably work:

<span class="comment_meta">With: </span><?php comments_popup_link(
    '', // No comments exist, you would probably want to display a link here in order for people to add the first comment
    '1 comment', // 1 comment, usually phrased differently
    '% comments' // > 1 comment
); ?>

If you don't want to display the "With:" label in case there are no comments you could just put it inside an if statement. I think thismight work:

<span class="comment_meta"><?php if (wp_count_comments(get_the_ID()) : ?>With: <?php endif; ?></span>

The problem is that you are echoing inside a string concatenation. Think of echo as something that will always begin on a new line. In most cases it's wisest to perform any calculations or string concatenations and store the result in a variable, and the echo $var; on the following line.

In this particular case though we are dealing with a WordPress core function (comments_popup_link()) that does the echoing for us. This will probably work:

<span class="comment_meta">With: </span><?php comments_popup_link(
    '', // No comments exist, you would probably want to display a link here in order for people to add the first comment
    '1 comment', // 1 comment, usually phrased differently
    '% comments' // > 1 comment
); ?>

If you don't want to display the "With:" label in case there are no comments you could just put it inside an if statement. I think thismight work:

<span class="comment_meta"><?php if (wp_count_comments(get_the_ID())) : ?>With: <?php endif; ?></span>
Added missing colon
Source Link
Simon
  • 1.2k
  • 7
  • 10

The problem is that you are echoing inside a string concatenation. Think of echo as something that will always begin on a new line. In most cases it's wisest to perform any calculations or string concatenations and store the result in a variable, and the echo $var; on the following line.

In this particular case though we are dealing with a WordPress core function (comments_popup_link()) that does the echoing for us. This will probably work:

<span class="comment_meta">With: </span><?php comments_popup_link(
    '', // No comments exist, you would probably want to display a link here in order for people to add the first comment
    '1 comment', // 1 comment, usually phrased differently
    '% comments' // > 1 comment
); ?>

If you don't want to display the "With:" label in case there are no comments you could just put it inside an if statement. I think thismight work:

<span class="comment_meta"><?php if (wp_count_comments(get_the_ID()) : ?>With: <?php endif; ?></span>

The problem is that you are echoing inside a string concatenation. Think of echo as something that will always begin on a new line. In most cases it's wisest to perform any calculations or string concatenations and store the result in a variable, and the echo $var; on the following line.

In this particular case though we are dealing with a WordPress core function (comments_popup_link()) that does the echoing for us. This will probably work:

<span class="comment_meta">With: </span><?php comments_popup_link(
    '', // No comments exist, you would probably want to display a link here in order for people to add the first comment
    '1 comment', // 1 comment, usually phrased differently
    '% comments' // > 1 comment
); ?>

If you don't want to display the "With:" label in case there are no comments you could just put it inside an if statement. I think thismight work:

<span class="comment_meta"><?php if (wp_count_comments(get_the_ID()) ?>With: <?php endif; ?></span>

The problem is that you are echoing inside a string concatenation. Think of echo as something that will always begin on a new line. In most cases it's wisest to perform any calculations or string concatenations and store the result in a variable, and the echo $var; on the following line.

In this particular case though we are dealing with a WordPress core function (comments_popup_link()) that does the echoing for us. This will probably work:

<span class="comment_meta">With: </span><?php comments_popup_link(
    '', // No comments exist, you would probably want to display a link here in order for people to add the first comment
    '1 comment', // 1 comment, usually phrased differently
    '% comments' // > 1 comment
); ?>

If you don't want to display the "With:" label in case there are no comments you could just put it inside an if statement. I think thismight work:

<span class="comment_meta"><?php if (wp_count_comments(get_the_ID()) : ?>With: <?php endif; ?></span>
Source Link
Simon
  • 1.2k
  • 7
  • 10
Loading