Atomic Blocks Theme


#1

I’m having an odd issue with the Atomic Blocks theme. The date stamp on comments, which is a link, is producing a double URL that directs to the 404 page when clicked. I’ve looked at the theme code, and it seems to be fine. It’s also not related to plugins. So, I’m left thinking that it’s something with CP because it is different from WP.

Happy to provide file/code/screenshot. It’s a little thing, but it’s quite annoying.


#2

A screenshot and a link to the file in question would be helpful in taking a closer look at this.


#3

Go here, scroll down to the comments and hover over the date stamp. Look down at the bottom of the screen and you’ll see the double URL.

Not sure how to attach files here…?


#4

You’d use this icon to attach a screenshot, or drag or paste it in, as the help text in an empty reply says:

Anyway I’ve got a screenshot of the link with the bad URL, and the markup structure around it, which will help to identify the right place in the theme:

Next steps for troubleshooting:

  • Look at the specific part of the theme code that generates this link and see if we can figure out a cause
  • See if the same issue appears on a fresh install of ClassicPress with this theme
  • See if the same issue appears on a fresh install of WordPress 4.9.9 with this theme

#5

Hi Jane,

Where are those links set? If I look at the source code I can see:

<a class=“comment-time” href="8https://jane.ws/too-much-food/#comment-8 ">February 2, 2019 at 8:37</a>

You have an 8 in front of https. I assume that’s why you are getting a 404.


#6

Thanks for the tip.

I can give you the theme code that generates the timestamp link.

<a class="comment-time" href="<?php echo esc_url( get_comment_link( comment_ID() ) ) ?> "><?php printf( esc_html__( '%1$s at %2$s', 'atomic-blocks' ), get_comment_date(),  get_comment_time() ); ?></a>

It’s on line 111 in template-tags.php, which is an include within the Atomic Blocks theme.


#7

Yes, it’s an odd extra character. I can’t for the life of me figure out where it’s coming from.


#8

Somehow associated with comment_ID:
8https…/#comment-8
9https…/#comment-9


#9

I thought so, but how? (I’m terrible with PHP, sorry.)


#10

Start here: https://codex.wordpress.org/Function_Reference/comment_ID

As I look at the code you shared, it’s not really clear to me why the comment date is enclosed in a link?


#11

So this should be get_comment_ID() instead, because comment_ID() displays the comment ID on the page, but this function should be returning it instead. This is the same in WordPress and ClassicPress.

I’m not sure how this code can work for anyone, and you should report it as an issue with the developer of the theme. To fix the issue on your site, you can replace it with get_comment_link( get_comment_ID() ) or just get_comment_link().

If you’re making this change directly in the parent theme, you’ll need to remember that it will be overwritten next time the theme is updated.


#12

The date serves as the permalink to each comment.


#13

Yes, thank you! I would love to have it as plain text. The link is completely unnecessary.


#14

But why is that necessary? I’d rather have the timestamp as plain text.


#15

Ah! I see, James. So, in case you wanted to link directly to that comment…


#16

It’s not something you do every day, but especially in a longer discussion it’s really useful to be able to link directly to a specific comment or a specific comment thread. We do that a lot when pointing people to specific forum posts on Slack, for example.


#17

Understood. Is there any way to resolve this, other than installing WordPress? (Ugh.)


#18

Works the same on WP or CP. WP won’t fix it. Let your theme developer know what you found.


#19

Installing WordPress won’t fix this, it’s an error in the theme code.

You can edit the theme directly to use the correct function call, report the issue to the theme developer and get them to fix it, or make a child theme that overrides this specific part of the theme.


#20

I used get_comment_ID and it now works. Thank you so much! This was driving me batty. :grinning:

I will report the issue to the theme author.