How to add media like select and tweet (plus free plug-in!) to WordPress

In recent weeks, I have added the ability to select and tweet text to my blog. If you have not found this feature, use it now. Very handsome. Catalin Nita, one of the front-end developers, uploaded this feature to the blog (thanks Catalin!). I think it can be shared and used today. Therefore, today we will introduce you to the setting method and the free plug-in at the end of the post. Read the post in \
The selection and twitter features provide a concise way for readers to share citations that can be cited. The functionality of our website operates in a similar way. When you double-click a word or highlight several words, a small twitter icon is displayed. Clicking the icon will automatically run twitter mode with the selected text and post links. Design this feature so that icons appear above the highlighted text, reducing attention to the reader. Finally, we don’t want to block the text we want to read. The easiest way to add a select and tweet add-on site to a WordPress site is to scroll to the bottom of the article and the plug-in as is. You can install it, activate it, and start right away. The plug-in uses the standard word press class and works only on a single post page. The topic must use a standard class name, or the plug-in may not work. To learn how to build this feature and continue reading, we will code the plug-in from scratch in the rest of this tutorial. The
Create an empty plug-in create a folder named \
Select and tweet CSS select and tweet JS, the file and extract it into the plug-in directory. The fonts directory contains four files. Before adding content to CSS and JS files, we add it to the queue. Select and tweet Paste the following code into the PHP file: Load summary 220838aa9dd3804a7dee JavaScript uses jQuery, so we add jQuery to the third parameter to load it. In addition, to ensure that the script has been loaded into the footnote, we added true as the fifth parameter (not required before). The
Understand that by default, when the user selects part of the text, he tries to display the correctly placed button. The selection process begins with a MouseDown event (the user presses the mouse button) and ends with a mouseup event (the user releases the button). We want to make sure that’s not the right button. In this case, the default browser menu must be displayed. You must select at least 3 characters. This prevents inadvertent and slow double clicking or small selection. First, let’s write two helper functions to rely on. One checks whether clicking is a right-click, and the other returns the selected text. The
In addition to invoking all wrappers by preparing documents,

Author:

Leave a Reply

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