The Recomendaciones feature automatically appends a section of related posts at the bottom of every single post on your WordPress site. It hooks into theDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/Jhon-mantila/pluging-wordpress/llms.txt
Use this file to discover all available pages before exploring further.
the_content filter, reads the first category of the current post, and renders a curated selection of posts from that same category — without any manual shortcode placement required. You control everything from the EsquinaWeb → Recomendaciones admin page.
How It Works
When a visitor loads a single post (is_single() is true), the plugin reads the esquina_recomendaciones_settings option and, if the feature is enabled, runs a WP_Query to find related posts. The current post is excluded, and results are filtered to the first category assigned to the post.
Load settings
The filter callback calls
get_option('esquina_recomendaciones_settings') and checks the enabled flag. If the feature is disabled, the original content is returned unchanged.Resolve the post category
get_the_category() is called on the current post. If no categories are assigned, the content is returned unchanged. Otherwise, the first category ($categorias[0]) is used as the filter.Run the WP_Query
A
WP_Query is built with cat set to the first category’s term ID and post__not_in set to the current post ID. The number of posts retrieved is controlled by the posts_per_page setting.mode: latest—orderby => date,order => DESCmode: random—orderby => rand
Configuration Settings
All settings are managed under EsquinaWeb → Recomendaciones in the WordPress admin. They are stored as a serialized array in theesquina_recomendaciones_settings option.
Activates or deactivates the entire feature. When unchecked, no recommendations HTML is appended to any post.
The heading text displayed above the recommendations block. The post’s category name is appended automatically — for example, “Recomendaciones de Tecnología”.
Number of related posts to display. Available options: 2, 3, 4, 5, 6, 8. Default is 6.
Controls how related posts are selected:
latest— ordered by publish date, newest first.random— ordered randomly on each page load.
Controls the visual layout of the recommendations block:
grid— a standard CSS grid of cards.carousel— a Netflix-style horizontal carousel with navigation arrows.
(Carousel only) When enabled, the carousel automatically advances through slides. The speed is controlled by the Speed setting. This value is passed to the frontend JavaScript as
window.esquinaRecSettings.autoplay.(Carousel only) The interval between automatic slide advances in milliseconds:
- 5000 — Slow (5 seconds)
- 3000 — Medium (3 seconds)
- 2000 — Fast (2 seconds)
window.esquinaRecSettings.speed.(Carousel only) Controls the visual size of carousel cards via a CSS modifier class:
small→.esquina-size-smallmedium→.esquina-size-mediumlarge→.esquina-size-large
When enabled, the featured image of each recommended post is displayed inside its card using
the_post_thumbnail('medium').When enabled, a “Ver más artículos de [Category]” link is appended below the recommendations block, pointing to the category archive page.
CSS Classes
The following CSS classes are output by the recommendations renderer and can be used for custom styling:| Class | Description |
|---|---|
.esquina-recomendaciones | Outer <section> wrapper for the entire block |
.esquina-grid | Container when grid layout is selected |
.esquina-carousel-wrapper | Outer wrapper when carousel layout is selected |
.esquina-carousel | The scrollable carousel track |
.esquina-prev / .esquina-next | Left and right navigation arrow buttons |
.esquina-card | Individual recommendation post card (<article>) |
.esquina-size-small | Applied to the section when carousel size is small |
.esquina-size-medium | Applied to the section when carousel size is medium |
.esquina-size-large | Applied to the section when carousel size is large |
.esquina-category-link | Container <div> wrapping the “Ver más artículos” link |
JavaScript Localisation
The frontend carousel script (recomendaciones.js) receives its configuration via wp_localize_script. The object is available globally as window.esquinaRecSettings:
autoplay field is true whenever the checkbox is checked, regardless of the current layout setting — the JavaScript simply finds no .esquina-carousel elements to scroll when the grid layout is active, so the setting has no visible effect in that case. The speed field defaults to 5000 if no value has been saved.
Single Posts Only
Recommendations are appended only on single post pages where
is_single() returns true. They do not appear on archive pages, category listing pages, tag pages, search results, or the homepage. If you need recommendations in other contexts, you will need to add a custom filter.Related Pages
Admin Panel
Configure the Recomendaciones settings through the EsquinaWeb admin dashboard.
Caching
Learn how WordPress transients reduce repeated database queries from related post lookups.
Performance Tips
Recommendations with random mode disable query caching — see tips for high-traffic sites.
Security Best Practices
All output is escaped with
esc_html() and esc_url() before rendering.