Converting Hashtags Into Links Using JavaScript in WordPress



In this #WordPress tutorial you will learn how to use #JavaScript and Regular Expressions to turn blog post words with hashtags into clickable links automatically.

Here is the regular expression used in the video:
/#(w+)/g

JavaScript replace() Method – https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/String/replace

Regular Expressions – https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions

Character Classes – https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions/Character_Classes

Timestamps:
00:00 – Introduction
00:53 – Quick Overview
01:04 – SEO Concerns with JavaScript links
01:45 – The JavaScript querySelector
02:10 – What are regular expressions?
02:33 – JavaScript replace() method
03:06 – Regular Expressions more in-depth
06:18 – My WordPress setup
07:31 – Creating a test post
08:44 – Create the JavaScript file
09:43 – Selecting text with querySelector
13:46 – Fixing null error on other pages
16:03 – Using the JavaScript replace() method
19:19 – Testing if the hashtag replace works
20:41 – Finishing up with JavaScript’s innerHTML

🔴Click to Subscribe: https://www.youtube.com/channel/UCxvTDYuA2S_83tk_0zfh-jw?sub_confirmation=1

😍Let’s Connect!
Website: https://www.wplevels.com/
FaceBook: https://www.facebook.com/wplevels/
FaceBook Group: https://www.facebook.com/groups/wplevels/
Twitter: https://twitter.com/wp_levels
Instagram: https://www.instagram.com/wplevels/

source

You might like

Leave a Reply

Your email address will not be published. Required fields are marked *



Important:
This site makes use of cookies which may contain tracking information about visitors. By continuing to browse this site you agree to our use of cookies.