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 facebook_posts shortcode fetches posts from a Facebook page via the Facebook Graph API v25.0 and renders them as an interactive, paginated card grid. It supports photo, video, and text-only posts. The first page of results is cached in a WordPress transient for 5 minutes to avoid repeated API calls on every page load. Clicking any card opens a modal overlay with the full post message, media, formatted publication date, and a direct link to the post on Facebook.

Token Configuration

Before placing the shortcode, you must supply a Facebook Page Access Token. The plugin resolves the token in the following order of priority: 1. Admin settings panel (recommended) Navigate to EsquinaWeb → Facebook in your WordPress dashboard and paste the token into the Access Token field. It is stored under the option key esquina_facebook_settings[access_token]. 2. wp-config.php constant
wp-config.php
define('ESQUINA_FB_PAGE_ACCESS_TOKEN', 'your_page_access_token');
3. WordPress filter
functions.php
add_filter('esquina_fb_access_token', function() {
    return 'your_page_access_token';
});
Never paste your access token directly into a shortcode attribute. Tokens embedded in post content are visible to anyone who can read the database or page source. Use the admin settings panel, wp-config.php, or the filter hook instead.

Basic Usage

[facebook_posts page_id="631930116676494" limit="25" per_page="4"]

Parameters

page_id
string
required
Numeric Facebook page ID whose posts will be fetched. When left blank, the plugin falls back to the value stored in the admin settings field esquina_facebook_settings[page_id]. If neither is set, the shortcode renders an error message.
limit
integer
default:"25"
Total number of posts to fetch from the Graph API in a single request (minimum 1, maximum 100). All fetched posts are cached client-side and paginated locally. When the user navigates past the last locally cached post, the AJAX endpoint is called automatically to fetch the next batch.
per_page
integer
default:"4"
Number of post cards displayed per page (minimum 1, maximum 20). The first card on each page is rendered as a featured (large) card; the remaining cards appear as smaller tiles alongside it.

API Fields Fetched

The plugin requests the following fields from the Graph API for each post:
id, message, created_time, permalink_url, attachments{media_type,media,subattachments}

Media Support

The plugin traverses the attachments tree returned by the API to find the first usable media item:
  • photo — renders a card with a thumbnail image, a text preview of the message, and the post date. The modal displays the full-size image.
  • video — renders a card with a muted, auto-playing looping <video> element (poster image used as fallback). The modal shows the video player with audio enabled.
  • Text-only posts — render without any media area, showing only the message preview.
Nested subattachments inside an attachment node are recursively traversed until a usable photo or video item is found.

AJAX Endpoint for Loading More

When the user navigates forward past all locally cached posts and a next-page cursor is available, the JavaScript client automatically fires a POST request to load more:
PropertyValue
Actionesquina_fb_more
Hookswp_ajax_esquina_fb_more, wp_ajax_nopriv_esquina_fb_more
Nonceesquina_fb_feed
POST parameters
ParameterDescription
actionesquina_fb_more
nonceSecurity nonce value
page_idFacebook page ID
limitNumber of posts to request
afterPagination cursor returned by the previous API response
Success response
{
  "success": true,
  "data": {
    "posts": [ /* normalized post objects */ ],
    "next_cursor": "cursor_string_or_empty"
  }
}

CSS Classes Reference

ClassDescription
.esquina-fb-feedRoot wrapper element for the entire feed. Holds the data-config JSON attribute.
.esquina-fb-feed__layoutCard grid container. Uses a 2-column CSS grid (1 featured + up to 3 small cards). Collapses to a single column on screens ≤ 768 px.
.esquina-fb-cardIndividual post card (a <button> element).
.esquina-fb-card--featuredThe first card on each page — spans all grid rows in the left column.
.esquina-fb-card--smallSecondary cards — stacked in the right column.
.esquina-fb-card__mediaAbsolute-positioned media layer (image or video).
.esquina-fb-card__overlayGradient overlay that darkens the media for text legibility.
.esquina-fb-card__excerptPost message preview text, anchored to the card’s bottom edge.
.esquina-fb-feed__pagerPagination bar containing Anterior and Siguiente buttons.
.esquina-fb-feed__metaPage indicator label (e.g. Página 1 / 3).
.esquina-fb-modalFull-screen modal overlay; hidden by default via the hidden attribute.
.esquina-fb-modal__backdropSemi-transparent click-to-close backdrop.
.esquina-fb-modal__dialogScrollable modal dialog (max width 720 px, max height 90 vh).
.esquina-fb-modal__mediaMedia container inside the modal (image or video player with audio).
.esquina-fb-modal__bodyText area with date, full message, and Facebook link.
.esquina-fb-feed__errorError message paragraph rendered when the API call fails or page_id is missing.

Examples

[facebook_posts]

Build docs developers (and LLMs) love