PHPackages                             djanym/wphelpers - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [Utility &amp; Helpers](/categories/utility)
4. /
5. djanym/wphelpers

ActiveLibrary[Utility &amp; Helpers](/categories/utility)

djanym/wphelpers
================

A set of helpers for custom themes and plugins

1.1.0(4y ago)012MITPHPPHP ^7.4 || ^8.0

Since Feb 1Pushed 8mo ago1 watchersCompare

[ Source](https://github.com/djanym/wphelpers)[ Packagist](https://packagist.org/packages/djanym/wphelpers)[ RSS](/packages/djanym-wphelpers/feed)WikiDiscussions main Synced today

READMEChangelogDependenciesVersions (2)Used By (0)

WPHelpers
=========

[](#wphelpers)

Helper functions for custom themes or plugins. This package provides a collection of static helper classes and global utility functions to streamline WordPress development.

Table of Contents
-----------------

[](#table-of-contents)

- [Installation](#installation)
- [Classes and Features](#classes-and-features)
    - [AdminHelper](#adminhelper)
    - [BaseHelper](#basehelper)
    - [ConfigHelper](#confighelper)
    - [ContentHelper](#contenthelper)
    - [FrontHelper](#fronthelper)
    - [Navwalker](#navwalker)
    - [PluginContentHelper](#plugincontenthelper)
    - [WpBlocksHelper](#wpblockshelper)
- [Global Functions](#global-functions)

Installation
------------

[](#installation)

```
composer require djanym/wphelpers
```

Classes and Features
--------------------

[](#classes-and-features)

### AdminHelper

[](#adminhelper)

Customizes the WordPress admin interface.

- **`globalContentPage(array $args = [])`**: Adds a global content (options) page via ACF and an entry in the admin toolbar.
- **`hide_frontpage_featured_image()`**: Hides the featured image field on the designated front page.
- **`hide_page_cpt_featured_image()`**: Removes featured image support for all pages.
- **`hide_frontpage_editor()`**: Hides the main editor field on the front page.
- **`hide_blogpage_editor()`**: Hides the main editor field on the designated blog page.
- **`hide_page_editor(array $args = [])`**: Hides the main editor field for pages based on their template (e.g., `['template' => 'page-contact.php']`).

### BaseHelper

[](#basehelper)

Enables advanced menu features using ACF.

- **`enable_mega_menu()`**: Registers ACF fields for menu items to enable MegaMenu functionality (container, column count, hide column titles) and applies corresponding CSS classes.
- **`enable_show_hide_menu_option()`**: Registers ACF fields to show or hide menu items based on the user's logged-in status.

### ConfigHelper

[](#confighelper)

Site-wide configuration and optimization utilities.

- **`disable(array $features)`**: Disables various WordPress features like `emojis`, `gutenberg`, `wp_generator`, `pingback`, `comments`, etc.
- **`disableAllExcept(array $exclude)`**: Disables all optional features except the specified ones.
- **`remove_src_version($src)`**: Removes the `ver=` query string from scripts and styles.
- **`remove_unnecessary_headers($headers)`**: Cleans up HTTP headers.
- **`excerpt_length($length)`** &amp; **`excerpt_more($more)`**: Configures post excerpt settings.
- **`remove_archive_title_prefix()`**: Removes prefixes like "Category: ", "Tag: ", etc., from archive titles.
- **`make_cpt_order_by_menu($post_type)`**: Sets a custom post type to order by `menu_order` by default in both admin and front-end.

### ContentHelper

[](#contenthelper)

Helpers for handling and displaying content.

- **`get_cover_image_src($post_id)`**: Retrieves the cover image URL, checking the featured image, a custom field, or a default fallback.
- **`get_cover_image()`**: Returns the full HTML `` tag for the cover image.
- **`year_shortcode()`**: Adds a `[year]` shortcode to display the current year.
- **`paginator(array $args = [])`**: A highly customizable pagination function compatible with Bootstrap.

### FrontHelper

[](#fronthelper)

General front-end utility functions.

- **`body_class($class)`**: Easily adds a custom class to the `` element.
- **`get_category_tree($args)`** &amp; **`get_term_tree($args)`**: Retrieves a hierarchical tree of terms/categories.
- **`has_child_pages($post_id)`**: Checks if a given page has child pages.
- **`get_current_post_type()`**: Detects the post type for the current query (works for archives, singles, and taxonomies).

### Navwalker

[](#navwalker)

A custom `Walker_Nav_Menu` implementation, often used for Bootstrap-compatible navigation menus.

#### Usage

[](#usage)

```
wp_nav_menu( [
    'menu_class'  => 'navbar-nav',
    'fallback_cb' => '\Ricubai\WPHelpers\Navwalker::fallback',
    'walker'      => new \Ricubai\WPHelpers\Navwalker(),
] );
```

### PluginContentHelper

[](#plugincontenthelper)

Integrations with popular WordPress plugins.

- **`cf7_submit_gtag_event(string $send_to)`**: Adds a Google Tag Manager event for Contact Form 7 submissions.
- **`cf7_format_optgroup_for(string $field_id)`**: Adds `optgroup` support to CF7 select fields using a specific naming convention (`optgroup-` prefix).
- **`cf7_disable_autop()`**: Disables automatic paragraph formatting in Contact Form 7.
- **`is_show_toc()`**: Checks if Easy Table of Contents should be displayed on the current page.
- **`show_toc_outside_content()`**: Manually renders the TOC outside of `the_content()` using shortcodes.

### WpBlocksHelper

[](#wpblockshelper)

Customization for the Gutenberg block editor.

- **`register_block(string $block_path)`**: Registers a custom Gutenberg block.
- **`add_block_styles(string $block_name, array $args)`**: Registers custom block styles.
- **`add_editor_block_category(array $args)`**: Adds a new block category in the editor.
- **`add_editor_color_palette(array $palette)`**: Merges a custom color palette with the default WordPress editor colors.
- **`remove_block_default_styles()`**: Removes default core block styles via JavaScript.
- **`disable_editor_fullscreen()`**: Disables the block editor's fullscreen mode by default.

Global Functions
----------------

[](#global-functions)

The following functions are available globally if `WPHelpers` is active:

- **`echo_if($var, $value, $print)`**: Echoes `$print` if `$var === $value`.
- **`echo_if_else($var, $value, $print_if, $print_else)`**: Echoes `$print_if` if `$var === $value`, otherwise echoes `$print_else`.
- **`get_cf_content($cf_name, $post_id = null)`**: Retrieves a custom field value from the current post or falls back to an ACF options page.
- **`get_cover_image_src()`**: Global wrapper for `ContentHelper::get_cover_image_src()`.
- **`the_cover_image()`**: Global wrapper for `ContentHelper::get_cover_image()`.
- **`has_child_pages($post_id)`**: Global wrapper for `FrontHelper::has_child_pages()`.

###  Health Score

29

—

LowBetter than 57% of packages

Maintenance42

Moderate activity, may be stable

Popularity5

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity54

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Unknown

Total

1

Last Release

1612d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/84af7f2439062306b6f1bf886ca9b8f008164081aa7ef4be08e4569778c14ba3?d=identicon)[djanym](/maintainers/djanym)

---

Top Contributors

[![djanym](https://avatars.githubusercontent.com/u/8123590?v=4)](https://github.com/djanym "djanym (68 commits)")

### Embed Badge

![Health badge](/badges/djanym-wphelpers/health.svg)

```
[![Health](https://phpackages.com/badges/djanym-wphelpers/health.svg)](https://phpackages.com/packages/djanym-wphelpers)
```

###  Alternatives

[graze/supervisor

:vertical\_traffic\_light: Process supervisor for PHP.

989.3k](/packages/graze-supervisor)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
