Notifications
Clear all

Suggestion [Solved] Anchor links to quoted posts

5 Posts
2 Users
4 Likes
674 Views
Wendell
Posts: 238
Topic starter
(@wendell)
Reputable Member
Joined: 5 years ago

When someone replies with a quote, it would be great if a link could be added to the quote somehow that would take you back to the quoted text (see attached image).

If that's not possible, perhaps the quoted text could just link back to the post quoted from instead of the specific text within the post.

Topic Tags
4 Replies
Chris
Posts: 2353
Admin
(@chris)
Support Team
Joined: 1 year ago

Hi @wendell,

1. Download and Install "Code Snippets" Plugin for WordPress

2. Open Dashboard > Snippets > Add NewΒ 

3. Write a Title

4. Add the Below Code, Check the "Only run on site front-end" Checkbox and press Save Changes and Activate

add_action( 'wp_footer', function () { ?>
<script>

	jQuery(document).ready( function($){
		let blockquotes = $('blockquote[data-postid]');
		blockquotes.css('cursor', 'pointer');
		blockquotes.on('click', function(){
			let postid = parseInt( $(this).data('postid') );
			if( !isNaN(postid) ) window.location.hash = 'post-' + postid;
		});
	});

</script>
<?php } );

Β 

2 Replies
Wendell
(@wendell)
Joined: 5 years ago

Reputable Member
Posts: 238

@chrisΒ 

Wow! Thank you for this. πŸ™‚

I've implemented it with a custom functions plugin and it works great.

If I may be so bold, do you think it could be implemented with an icon and link instead of the entire blockquote box? https://share.getcloudapp.com/4guP5q9k (just a thought, certainly not required) πŸ™‚

Chris
Admin
(@chris)
Joined: 1 year ago

Support Team
Posts: 2353

@wendell,

There are many changes needed for that, not only coding also design, so it will take time to finish the work, we have added it in our to-do list, so it will be added in wpForo 2.0.0 update.

Wendell
Posts: 238
Topic starter
(@wendell)
Reputable Member
Joined: 5 years ago

Thanks Chris! 🙂