How to replace Popular Post Widget by shortcode
-
Hi @hcabrera
In…
On the right. “Most viewed on TLM”
… you can see what I have to reproduce.
Although now the images have been poorly framed, after restoring the database.
If I give you the parameters, could you help me with a shortcode example?
-
Hola @vitodumas,
Como tu sitio web está en Espa?ol asumiré que hablas el idioma (y quizás así se haga más fácil la comunicación).
Si quieres emular el tema Cardview con el shortcode prueba ésto:
[wpp range='last7days' excerpt_length=75 stats_views=0 stats_taxonomy=1 thumbnail_width=304 thumbnail_height=154 wpp_start='<ul class="wpp-list wpp-cardview">'[wpp range='last7days' stats_views=0 thumbnail_width=304 thumbnail_height=154 wpp_start='<ul class="wpp-list wpp-cardview" post_html='<li class="{current_class}"><div class="wpp-thumbnail-container">{thumb}<div class="taxonomies">{taxonomy}</div></div> <div class="wpp-item-data">{title} <p class="wpp-excerpt">{excerpt}</p></div></li>']
Probablemente también necesitarás los estilos del tema Cardview, si es así aquí los encuentras.
Ah, y cambia el parámetro range al rango de tiempo que quieras (ver Parameters > range). Coloqué last7days para mostrarte cómo se usa.
Almost
[wpp range='last120hours' excerpt_length=0 stats_views=0 stats_taxonomy=0 thumbnail_width=304 thumbnail_height=154 wpp_start='<ul class="wpp-list wpp-cardview">'[wpp range='last7days' stats_views=0 thumbnail_width=304 thumbnail_height=154 wpp_start='<ul class="wpp-list wpp-cardview" post_html='<li class="{current_class}"><div class="wpp-thumbnail-container">{thumb}</div> <div class="wpp-item-data">{title} <p class="wpp-excerpt">{excerpt}</p></div></li>'][wpp range='last120hours' excerpt_length=0 stats_views=0 stats_taxonomy=1 thumbnail_width=304 thumbnail_height=154 wpp_start='<ul class="wpp-list wpp-cardview">'[wpp range='last7days' stats_views=0 thumbnail_width=304 thumbnail_height=154 wpp_start='<ul class="wpp-list wpp-cardview" post_html='<li class="{current_class}"><div class="wpp-thumbnail-container">{thumb}</div> <div class="wpp-item-data">{title} <p class="wpp-excerpt">{excerpt}</p></div></li>']
I want just the title, but aligned to the left.
<div aligin=”left”>doesn’t work.I don’t know how to choose “Show only posts published in the selected time range”
I don’t know how to exclude post: Example: 165170,165217,165092,165280,165095,165170
I already discovered why I don’t see the “block” widget available in Classic Widgets.
I see it on websites where I have the Widget Options plugin installed, and I don’t see it where I have the Widget Options – Extended plugin installed.
I just wrote to tech support.
However, the shortcode makes my life much easier.
I also get a dot to the left of the thumbnail (<li>) but I’ll remove it with css.
Perhaps on that website I can downgrade Widget Options – Extended to the free version, since it would already be fixed and working with the block.
Also, it’s easier to exclude entries and everything else.
I’ll see if I’m not using the extended functions, and in that case I’ll downgrade to the free version so that the widget block appears.
I leave it for today. 1:43. I’ve been with this since morning.
[wpp range=’last120hours’ …
“last120hours” isn’t a valid time range. Check the documentation again to learn what values are accepted.
Also, not sure if it’s a copy&paste mistake but the shortcode you shared above is semi broken as it is.
I want just the title, but aligned to the left.
Use CSS for this, see text-align.
I don’t know how to choose “Show only posts published in the selected time range”
The freshness parameter is what you’re looking for, see the Parameters link I shared above for more details.
I don’t know how to exclude post
Check out the pid parameter from the documentation.
Hi @hcabrera
I do not get it. Let’s see if I paste the code correctly now.
[wpp range='last4days' pid='165766,165217,165092,165280,165095,165170' excerpt_length=0 stats_views=0 stats_taxonomy=0 thumbnail_width=304 thumbnail_height=154 wpp_start='<ul class="wpp-list wpp-cardview">'[wpp range='last7days' stats_views=0 thumbnail_width=304 thumbnail_height=154 wpp_start='<ul class="wpp-list wpp-cardview" post_html='<li class="{current_class}"><div class="wpp-thumbnail-container">{thumb}</div> <div class="wpp-item-data">{title} </div></li>']
You can see the shortcode in action in this note. https://www.todalamusica.es/xxxi-edicion-de-clasicos-de-verano-llenan-de-musica-la-region/
In Firefox it looks acceptable.
In Chrome or Chromium the thumbnail is in the middle of the title text.I can’t get it to work in any way.
1) align-text: start; or align-text: left;
2) list-style: none;
3) pid=’165766,165217,165092,165280,165095,165170′
Finally, separate the entries a bit.I’m sorry.
The Popular Post Widget was just right for clumsy people like me.
I am so sorry that it will be discontinued.
Alright, try following these instructions and report back your results:
#1 I fixed your shortcode, use it exactly as it is (compare your version with mine to see what the problems were if you’re curious):
[wpp pid='165766,165217,165092,165280,165095,165170' range='last7days' freshness=1 excerpt_length=0 stats_views=0 thumbnail_width=304 thumbnail_height=154 wpp_start='<ul class="wpp-list wpp-cardview">' post_html='<li class="{current_class}"><div class="wpp-thumbnail-container">{thumb}</div> <div class="wpp-item-data">{title}</div></li>']
#2 Copy these CSS rules and add them to your site via WP Dashboard > Appearance > Customize > Additional CSS.
The Popular Post Widget was just right for clumsy people like me.
I am so sorry that it will be discontinued.
The WordPress Popular Posts block works exactly the same way as the classic widget, but since you can’t or won’t use it then your only other alternative is to use the [wpp] shortcode which is not as convenient for obvious reasons.
- This reply was modified 1 year, 5 months ago by Hector Cabrera. Reason: Added link to demo video
I have seen the differences and now your shortcode works exactly like the wpp widget. Even in Chrome.
I did not have to copy the css rules, because in Additional CSS I already had the ones that I modified years ago for the wpp widget.
I think the classes have the same name and that’s why it’s exactly the same as the original.
You are obviously right in what you say. I have to use a knowledge that I lack and you have plenty of.
Your version is already seen all over the site. Now or soon, I will do the same on all the other websites where I use wpp.
I’m sorry I was so annoying. My apologies to Jan Demobowski. He was unaware of what he comments. I thought he was on the same topic.
Thank you very much for your invaluable help.
Don’t worry about it. Glad I could help!
An incredible help.
That is certified.
Kind regards.
- The topic ‘How to replace Popular Post Widget by shortcode’ is closed to new replies.