2017 © Pedro Peláez
 

library wp-helpers

This package provides Wordpress housekeeping & helper functions.

image

carawebs/wp-helpers

This package provides Wordpress housekeeping & helper functions.

  • Thursday, February 15, 2018
  • by DavidEgan
  • Repository
  • 1 Watchers
  • 0 Stars
  • 18 Installations
  • PHP
  • 0 Dependents
  • 0 Suggesters
  • 0 Forks
  • 0 Open issues
  • 2 Versions
  • 0 % Grown

The README.md

WordPress Helpers

Odds and sods that are useful on most projects., (*1)

This library is in development and I may introduce breaking changes., (*2)

// Within theme
/**
* Run themehelper setup
*/
add_action('after_setup_theme', function() {

    // Apply Themehelper functions - basic housekeeping
    if (class_exists('\Carawebs\Helpers\Functions')) {
        $args = [];
        new \Carawebs\Helpers\Functions( $args );
    }

});

Menu Adjustment for Custom Post Type Views

Define the CPTs, menus and menu items to target from within the active theme. Use the format $keyvals['custom-post-type-slug'] => ['class'=>'menu-class-of-parent', 'text'=>'Text val of parent menu item'];, (*3)

// Define the custom post type view and the required parent menu item:
add_filter( 'carawebs/amend-menu-cpts-target-cpts', function($keyvals) {
    $keyvals['service'] = ['class' => 'services', 'text' => 'Services'];
    return $keyvals;
});

Define an array of menu locations for which the amendments should apply using the 'carawebs/amend-menu-cpts-target-locations' hook:, (*4)

add_filter( 'carawebs/amend-menu-cpts-target-locations', function() {
    return ['primary_navigation'];
});

The Versions

15/02 2018

dev-master

9999999-dev

This package provides Wordpress housekeeping & helper functions.

  Sources   Download

GNU GPL-3.0-only

21/03 2017

1.0.0

1.0.0.0

This package provides Wordpress housekeeping & helper functions.

  Sources   Download

GNU