dimadin/wp-code-reference

wporg-developer child theme with adjustments to use it for code reference of any WordPress project.

Installs: 0

Dependents: 0

Suggesters: 0

Security: 0

Stars: 4

Watchers: 1

Forks: 1

Open Issues: 0

Language:CSS

Type:wordpress-theme

dev-master 2018-09-15 18:12 UTC

This package is auto-updated.

Last update: 2024-11-16 08:02:53 UTC


README

WP Code Reference is a theme used for displaying code reference of WordPress project (plugin or any WordPress library or theme that follows inline WordPress PHP documentation standards).

Requirements

Yu will need Composer and WP-CLI, and PHP 5.4+.

Setup

There are two ways for setting everything up.

1.

If you manage your WordPress install and plugins with Composer (for example, with help of Bedrock), you just need to require dimadin/wp-plugin-code-reference package and it will install all necessary dependencies.

2.

In other case, you will need to manually setup all required dependencies.

Install parent theme

Checkout the developer.wordpress.org theme from the meta svn repository inside themes directory (usually /wp-content/themes).

svn checkout https://meta.svn.wordpress.org/sites/trunk/wordpress.org/public_html/wp-content/themes/pub/wporg-developer/

Install child theme

This repository contain child theme, WP Code Reference. Clone this repository inside themes directory.

Install WP-Parser

Inside plugins directory (usually /wp-content/plugins), clone WP-Parser and inside of it install its dependencies with composer install.

Install SyntaxHighlighter Evolved

This is not required, but it's recommended to install SyntaxHighlighter Evolved plugin for nicer code display.

Usage

When you have installed everything, activate WP-Parser and SyntaxHighlighter Evolved plugins, and WP Code Reference theme.

Then, you will need to install or clone repository of WordPress project you want to have code reference for. You can do it in its standard location (for example, if it's plugin inside plugins directory).

Finally, you need to run indexing command from WP-Parser. Go to project's directory and run

wp parser create . --user=1

where . stands for the current directory and --user=1 is for ID of a user that posts will be attributed to.

If you want link "View on GitHub" to work, you will also have to run

wp option update wp_parser_gh_repository 'user/repo'

where 'user/repo' is a path to your GitHub repository. If link is still not shown, run

wp option update wp_parser_imported_wp_version 'x.y.z'

where 'x.y.z' is a tag that you based on your code reference.

Notes

  • In one WordPress site, you can have code reference for just one project. If you want to have references for multiple projects, you either need to install separate WordPress instances and follow procedure from above, or have a WordPress multisite installation where each site in a network is for one project.
  • For every new version of your project, you will need to run parser as explained in section Usage. However, note that previously parsed resources that are no longer getting parsed (for example removed from the new version), are not removed from the database because of limitations of WP-Parser. You will need to reset database or do something else to remove them.
  • Directories /tests and /vendor are skipped and it will not be shown in code reference.