aldolat / posts-in-sidebar

Publish a list of posts in your sidebar
https://dev.aldolat.it/projects/posts-in-sidebar/
GNU General Public License v3.0
16 stars 8 forks source link

Under short content, Link not working in sidebar. #38

Closed Sadanand1991 closed 5 years ago

Sadanand1991 commented 6 years ago

I have added the short content with link in content box. it displayed in string format, not clickable link showing in sidebar. http://nimb.ws/Qij0HF http://nimb.ws/X4kmI2

aldolat commented 6 years ago

Hi, WordPress (and Posts in Sidebar with it) handles two types of excerpts:

  1. if there is no user-generated excerpt, WordPress creates one, removing any link (if present);
  2. if there is a user-generated excerpt, WordPress uses it, with any link (if present).

The plugin follows this behavior and I cannot modify it.

I think that the reason why WordPress removes the links (and any HTML tag) is that it must count the words to be displayed in the front-end. If we have the HTML tags, the counting will not be correct. Example:

Line without HTML tags:

This is the text for the post of my site to be published as soon as possible.

Line with HTML tags:

This is the text for the post of <a href="https://www.example.com" target="_blank">my site<a/> to be published as soon as possible.

If we want 10 words to be displayed in the excerpt, where WordPress should stop? For the first example it's simple: up to "site". But for the second example?

So, if you want to have links in your excerpts, my advice is to create them manually.

Please, let me know.