Skip to content

research-software-directory/rsd-wordpress

Repository files navigation

Research Software Directory plugin for WordPress

This repo contains a WordPress integration of the Projects and Software overview for the Research Software Directory, using the RSD API.

How to use the plugin

To display the overview (e.g. for the Software section for the Netherlands eScience Center organisation) on your Wordpress site, use the following shortcode in any post or page:

[research_software_directory section="software" limit="4" organisation="35c17f17-6b5f-4385-aa8b-6b1d33a10157"]

Deployment or unit testing: build compiled bundle files first

The current configuration uses Vite to build the plugin front end assets, CSS and JS. Before using the plugin in a production environment (which is the default), make sure to run the build script:

# First install the required Node.js dependencies
$ pnpm install

# Run the build script for production
$ pnpm run build

This will create minified CSS and JS bundle files according to the project's Browserslist configuration, and uses Autoprefixer and Babel to create cross-browser compatible code.

Note: See the section below for instructions on how to do this for a development environment.

Local development

Installing the plugin in WordPress

This plugin can be used in a new or existing WordPress intallation in a local development environment. For a super quick testing environment, the bundled docker-compose.yml can be used with the application Local.

First make sure your WordPress installation is functional, then move the plugin file to the plugins folder of your installation, which is usually something like <wordpress_folder>/wp-content/plugins/.

Building compiled bundle files for development

Similar to the above example, before using the plugin in a development environment, make sure to run the build script (which uses watch mode automatically):

# First install the required Node.js dependencies
$ pnpm install

# Run the build script for production
$ pnpm run dev

Editor configuration

This project uses EditorConfig to maintain a consistent coding style. Please make sure your editor applies this configuration to any of your code changes for this repo.

WordPress Coding Standards

To ensure code quality and adherence to coding conventions, before committing any changes to the code of this project, please use phpcs (see WordPress Coding Standards for PHP_CodeSniffer) with the bundle PHP_CS configuration file.

You can also use the bundled project PHP_CS configuration by running:

# Install PHP_CS and related packages
$ composer install

# Run PHP_CS to check all PHP files in the project
$ composer run lint

# Or use PHP Code Beautifier and Fixer to automatically correct coding standard violations
$ composer run format