Skip to main content

Documentation 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 Recomendaciones feature automatically appends a section of related posts at the bottom of every single post on your WordPress site. It hooks into the 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.
1

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.
2

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.
3

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: latestorderby => date, order => DESC
  • mode: randomorderby => rand
4

Render the recommendations block

The plugin outputs a <section class="esquina-recomendaciones"> block containing a heading, the post cards, and (optionally) a category link. The rendered HTML is appended to the original $content string.

Configuration Settings

All settings are managed under EsquinaWeb → Recomendaciones in the WordPress admin. They are stored as a serialized array in the esquina_recomendaciones_settings option.
enabled
checkbox
Activates or deactivates the entire feature. When unchecked, no recommendations HTML is appended to any post.
title
string
default:"Recomendaciones"
The heading text displayed above the recommendations block. The post’s category name is appended automatically — for example, “Recomendaciones de Tecnología”.
posts_per_page
select
Number of related posts to display. Available options: 2, 3, 4, 5, 6, 8. Default is 6.
mode
select
default:"latest"
Controls how related posts are selected:
  • latest — ordered by publish date, newest first.
  • random — ordered randomly on each page load.
layout
select
default:"grid"
Controls the visual layout of the recommendations block:
  • grid — a standard CSS grid of cards.
  • carousel — a Netflix-style horizontal carousel with navigation arrows.
autoplay
checkbox
(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.
speed
select
default:"5000"
(Carousel only) The interval between automatic slide advances in milliseconds:
  • 5000 — Slow (5 seconds)
  • 3000 — Medium (3 seconds)
  • 2000 — Fast (2 seconds)
This value is passed to the frontend as window.esquinaRecSettings.speed.
size
select
default:"medium"
(Carousel only) Controls the visual size of carousel cards via a CSS modifier class:
  • small.esquina-size-small
  • medium.esquina-size-medium
  • large.esquina-size-large
thumbnail
checkbox
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:
ClassDescription
.esquina-recomendacionesOuter <section> wrapper for the entire block
.esquina-gridContainer when grid layout is selected
.esquina-carousel-wrapperOuter wrapper when carousel layout is selected
.esquina-carouselThe scrollable carousel track
.esquina-prev / .esquina-nextLeft and right navigation arrow buttons
.esquina-cardIndividual recommendation post card (<article>)
.esquina-size-smallApplied to the section when carousel size is small
.esquina-size-mediumApplied to the section when carousel size is medium
.esquina-size-largeApplied to the section when carousel size is large
.esquina-category-linkContainer <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:
// Available as window.esquinaRecSettings
{
  autoplay: true,  // boolean — mirrors the "Autoplay" checkbox
  speed: 5000      // ms    — mirrors the "Speed" dropdown value
}
The 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.

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.

Build docs developers (and LLMs) love