Overview
These functions handle the core theme setup, including WordPress feature support, widget areas, script/style enqueuing, and custom post type registration.zalbi_setup()
Sets up theme defaults and registers support for various WordPress features. This is the primary initialization function that runs on theafter_setup_theme hook.
What It Does
- Enables theme translation support
- Adds automatic RSS feed links
- Enables WordPress title tag management
- Registers post thumbnail support
- Registers navigation menus
- Adds HTML5 support for core markup
- Configures custom background support
- Enables customizer selective refresh for widgets
- Adds custom logo support
Function Signature
Registered Menus
Navigation Menus
Navigation Menus
Supported Features
Post Thumbnails
Featured images enabled for posts and pages
Custom Logo
Supports logos up to 250x250px with flexible dimensions
HTML5 Markup
Search forms, comments, galleries, and more use valid HTML5
Custom Background
Default white background, customizable via Theme Customizer
Usage
This function is automatically hooked and runs during theme initialization:This function should not be called directly. It’s automatically executed by WordPress during theme setup.
zalbi_content_width()
Sets the global content width for embedded media based on the theme’s design.Function Signature
Parameters
NoneReturn Value
Sets the global
$content_width variable to 640 pixelsImplementation
Filter Hook
Modify the default content width value
zalbi_widgets_init()
Registers widget areas (sidebars) for the theme.Function Signature
Registered Widget Areas
Sidebar - Primary sidebar widget area
Usage
zalbi_scripts()
Enqueues all scripts and stylesheets for the theme, including external dependencies like Font Awesome and Google Fonts.Function Signature
Enqueued Assets
Stylesheets
Stylesheets
Main theme stylesheet (style.css)
- Version:
_S_VERSION(1.0.0) - RTL Support: Enabled
Font Awesome 6.4.0 icon library
- Source: Cloudflare CDN
Google Fonts - Nunito & Open Sans
- Nunito: 400, 700, 900 weights
- Open Sans: 400, 600 weights
JavaScript
JavaScript
Mobile navigation toggle functionality
- File:
/js/navigation.js - Version:
_S_VERSION - Footer: true
WordPress comment reply script (conditional)
- Loaded when: Singular post/page with threaded comments enabled
Implementation
Customization Example
zalbi_register_hinchables()
Registers the “Hinchable” (Inflatable) custom post type for the catalog of inflatable rentals.Function Signature
Post Type Details
Internal post type identifier
URL slug for SEO and Polylang compatibility
Configuration
- name: “Hinchables”
- singular_name: “Hinchable”
Publicly queryable and visible in admin
Archive page disabled (uses custom page templates)
Admin menu icon
Supported features:
title- Post titleeditor- Content editorthumbnail- Featured imageexcerpt- Short description
Usage Examples
URL Structure
zalbi_register_taxonomies()
Registers the “Tipo de Hinchable” (Inflatable Type) taxonomy for categorizing inflatables.Function Signature
Taxonomy Details
Internal taxonomy identifier
Associated post type
URL slug for taxonomy archives
Configuration
Key Features
Hierarchical
Supports parent/child relationships like categories
Block Editor
Full Gutenberg editor support
Admin Column
Shows assigned types in post list table
Public
Creates archive pages for each type
Usage Examples
URL Examples
zalbi_register_eventos()
Registers the “Evento” (Event) custom post type for showcasing event management services.Function Signature
Post Type Details
Internal post type identifier
URL slug for SEO purposes
Configuration
- name: “Eventos”
- singular_name: “Evento”
Publicly queryable and visible in admin
Archive disabled (uses custom template)
Calendar icon in admin menu
title- Event nameeditor- Event descriptionthumbnail- Featured imageexcerpt- Short summary
Implementation
Usage Examples
This post type is designed for showcasing completed events or event types, not for scheduling future events. Consider adding a plugin for event management features like dates and booking.
zalbi_customize_whatsapp()
Adds WhatsApp floating button configuration to the WordPress Customizer.Function Signature
Parameters
WordPress Theme Customizer manager object
Customizer Section
Botón WhatsApp - Section for configuring the floating WhatsApp button
Settings & Controls
WhatsApp phone number settingProperties:
- Default: Empty string
- Transport:
refresh - Sanitization:
sanitize_text_field - Label: “Número de teléfono”
- Description: “Escribe el número con prefijo (ej: 34658887358). Si lo dejas vacío, el botón desaparece.”
Implementation
Retrieving the Value
Display Logic
Template checks for value
Theme template checks if
zalbi_whatsapp_number theme mod exists and is not emptyConstants
_S_VERSION
Theme version constant used for cache busting assets
- Appended to script/style URLs as version parameter
- Forces browser cache refresh when theme is updated
- Should be incremented with each theme release
Hooks Reference
Actions Used
Actions Used
after_setup_theme- Runszalbi_setup()andzalbi_content_width()widgets_init- Runszalbi_widgets_init()wp_enqueue_scripts- Runszalbi_scripts()init- Runszalbi_register_hinchables(),zalbi_register_taxonomies(),zalbi_register_eventos()customize_register- Runszalbi_customize_whatsapp()
Filters Available
Filters Available
zalbi_content_width- Modify default content width (default: 640)zalbi_custom_background_args- Customize background feature arguments
Next Steps
Learn about template tag functions for displaying post metadata and content