Download the PHP package gebruederheitz/wp-theme-docs without Composer

On this page you can find all versions of the php package gebruederheitz/wp-theme-docs. It is possible to download/install these versions without Composer. Possible dependencies are resolved automatically.

FAQ

After the download, you have to make one include require_once('vendor/autoload.php');. After that you have to import the classes with use statements.

Example:
If you use only one package a project is not needed. But if you use more then one package, without a project it is not possible to import the classes with use statements.

In general, it is recommended to use always a project to download your libraries. In an application normally there is more than one library needed.
Some PHP packages are not free to download and because of that hosted in private repositories. In this case some credentials are needed to access such packages. Please use the auth.json textarea to insert credentials, if a package is coming from a private repository. You can look here for more information.

  • Some hosting areas are not accessible by a terminal or SSH. Then it is not possible to use Composer.
  • To use Composer is sometimes complicated. Especially for beginners.
  • Composer needs much resources. Sometimes they are not available on a simple webspace.
  • If you are using private repositories you don't need to share your credentials. You can set up everything on our site and then you provide a simple download link to your team member.
  • Simplify your Composer build process. Use our own command line tool to download the vendor folder as binary. This makes your build process faster and you don't need to expose your credentials for private repositories.
Please rate this library. Is it a good library?

Informations about the package wp-theme-docs

Wordpress Theme Admin Page and Documentation Maker

Add simply admin pages or a Wordpress theme documentation page to the editor.


Installation

via composer:

Make sure you have Composer autoload or an alternative class loader present.

Usage

This will set up a basic admin page under the "Tools" tab in the Wordpress backend with the translated title __('Extra Tools', 'ghwp') (/wordpress/wp-admin/tools.php?page=my-extra-admin-page).

In its most basic state, this renders a page empty except for the title. You will need to register sections to add some content.

Constructor (and factory) arguments

argument description
menuSlug Where the menu will be available under $menuLocation (?page={{this}})
title A title displayed as <h1> at the top of the page, will be run through __().
menuLocation Where to append the new submenu. Popular places are themes.php or tools.php.
menuTitle An alternative text for the menu entry. Defaults to $title.
overridePath An alternative path where consumers can put overrides templates to use instead of template-parts/meta/docs/documentation-page.php.
i18nNamespace The namespace used for translations for menu titles, titles and within the default templates (__(somestring, 'ghwp'))

Adding sections

Section registration & custom sections

Any section you add must implement the AdminPageSectionInterface. You can use the method addSection() or the filter hook to add your section to a page:

using addSection()
using the hook

For convenience, you can extend the AbstractAdminPageSection, which already has the interface implemented, only requiring you to implement three abstract getters to get it to run.

The above example sets up a section with the title Documentation for my amazing feature rendering from the template partial at the given path. The template is passed the instance of AdminPage and the current section:

Instead of setting the $partial property (or even extending the abstract class), you can also implement a custom rendering method:

The theme documentation page

This will set up the basic documentation page under the "Appearance" tab in the Wordpress backend with the translated title __('Theme-Help', 'ghwp') (/wordpress/wp-admin/themes.php?page=ghwp-help).

It's simply a preconfigured AdminPage, so you will need to add sections. In this case, you can add them right through the constructor by passing an array as the first argument:

Warning

Due to how PHP inheritance works, AdminPage's static ::factory() method is available on DocumentationMenu, but it should not be used, as it will return a simple AdminPage object, not a DocumentationMenu instance.

DocumentationMenu: Changing the title and the template used

You can change the title displayed on the documentation page by passing a string as the constructor's second argument:

You can override the default template by creating a file in your theme's root directory under template-parts/meta/docs/documentation-page.php.

Alternatively you may override this default path by supplying a second argument to the constructor:

Included sections

The sections included in this package all extend AbstractAdminPageSection.

This will register the sections and add them to the help page.

Shortcode Documentation Annotations

This module will automatically create a shortcode documentation for users based on the annotation class ShortcodeDocumentation. It is based on Doctrine's annotation reader.

Documenting shortcodes

This assumes you add your shortcodes via individual classes for each shortcode and have both the DocumentationMenu page class and the Shortcodes section class up and running.

Available annotation properties:
Property Type Description
shortcode string The actual shortcode that you use for registration.
description string A short description of what your shortcode is good for.
parameters map A map of parameter names and their descriptions, so users will know which parameters to pass and when.
examples string list A list of strings that will be wrapped in <pre><code></code></pre>, providing your users some examples of the shortcode's usage.

The simplest way to document your Shortcode is to use the trait provided:

Alternatively, you can register your annotation yourself:

Changing the template partial for the section

As with all section classes extending AbstractAdminPageSection, you have two options of modifying the default output:

Using the default override template

Create a file in your theme's root directory under template-parts/meta/docs/shortcodes.php. This template will be used instead of the provided default.

The section template will be called with two arguments: an instance each of DocumentationMenu and the section (Shortcodes):

Using a different template partial location

You'll need to extend the Shortcodes class and provide an alternative getter:

List of SVG icon partials

This module will render a list of all icons that can be used by editors (for instance via shortcodes). By default it searches template-parts/svg/ in your theme's root directory recursively for .php files, assuming they are templates containing SVG markup.

This is most useful in conjunction with a shortcode that can render these SVG partials, for instance into button blocks.

Setting a different path for SVG partials

Same as with the Shortcodes section.

Development

Dependencies

Migration

v1 to v2

changed v1 v2
moved Gebruederheitz\Wordpress\Documentation\DocumentationPage Gebruederheitz\Wordpress\AdminPage\Documentation\DocumentationPage
renamed Gebruederheitz\Wordpress\Documentation\DocumentationSectionInterface Gebruederheitz\Wordpress\AdminPage\AdminPageSectionInterface
renamed, moved Gebruederheitz\Wordpress\Documentation\Sections\AbstractDocumentationSection Gebruederheitz\Wordpress\AdminPage\AbstractAdminPageSection
moved Gebruederheitz\Wordpress\Documentation\Sections\Shortcode Gebruederheitz\Wordpress\AdminPage\Documentation\Section\Shortcode
moved Gebruederheitz\Wordpress\Documentation\Sections\Icons Gebruederheitz\Wordpress\AdminPage\Documentation\Section\Icons
moved Gebruederheitz\Wordpress\Documentation\Annotations\ShortcodeDocumentation Gebruederheitz\Wordpress\AdminPage\Documentation\Annotations\ShortcodeDocumentation
moved Gebruederheitz\Wordpress\Documentation\Traits\withShortcodeDocumentation Gebruederheitz\Wordpress\AdminPage\Documentation\Traits\withShortcodeDocumentation
--> Gebruederheitz\Wordpress\Documentation\Helper\AnnotationReader Gebruederheitz\Wordpress\AdminPage\Helper\AnnotationReader
new -- Gebruederheitz\Wordpress\AdminPage\AdminPage

All versions of wp-theme-docs with dependencies

PHP Build Version
Package Version
Requires php Version >=7.3
gebruederheitz/simple-singleton Version ^1.0
doctrine/annotations Version ^1.13
Composer command for our command line client (download client) This client runs in each environment. You don't need a specific PHP version etc. The first 20 API calls are free. Standard composer command

The package gebruederheitz/wp-theme-docs contains the following files

Loading the files please wait ....