Giter Club home page Giter Club logo

typecho-plugin-custom-header-footer's Introduction

Typecho Plugin Template

This is a template for developing Typecho plugins.

中文说明

How to Use

Click the "Use this template" button to create a new repository from this template.

Suggested Directory Structure

LICENSE
README.md
/plugin
    ├── Plugin.php
    ├── ...

All source code should be placed in the /plugin directory.

Plugin.php

The Plugin.php file is the main file of the plugin. It should contain a class named Plugin which implements the Typecho\Plugin\PluginInterface interface.

namespace TypechoPlugin\Example;

use Typecho\Plugin\PluginInterface;

/**
 * Example plugin.
 *
 * @package Example
 * @author Typecho
 * @version %version%
 * @link https://typecho.org
 */
class Plugin implements PluginInterface
{
    // Methods to implement the PluginInterface.
}

⚠️ Important notes:

  • The namespace of the plugin should be TypechoPlugin\{PluginName}. For example, if the plugin name is Example, the namespace should be TypechoPlugin\Example. This is required for the plugin to be loaded by Typecho.
  • The version of the plugin should be replaced with %version%. The version number will be replaced by the build script automatically. Do not replace the version number manually.

Naming rules:

  • The plugin name should contain only letters, numbers.
  • The plugin name should be in PascalCase.

Examples:

  • Example is a valid plugin name.
  • ExamplePlugin is a valid plugin name.
  • Example-Plugin is not a valid plugin name.
  • Example_Plugin is not a valid plugin name.

Debugging & Development

Use soft links to link the plugin directory to the usr/plugins directory of Typecho.

For example, if here is the directory structure of the plugin project and the Typecho project:

/path/to/plugin
    ├── /plugin
    │   ├── Plugin.php
    │   ├── ...
    │   └── ...
    └── ...
/path/to/typecho
    ├── /usr
    │   ├── /plugins
    │   │   ├── /Example
    │   │   │   ├── Plugin.php
    │   │   │   ├── ...
    │   │   │   └── ...
    │   │   └── ...
    │   └── ...
    └── ...

Run the following command in the /path/to/typecho/usr/plugins directory:

ln -s /path/to/plugin/plugin Example

Then you can debug and develop the plugin in the /path/to/plugin directory. The plugin directory name Example is the same as the plugin name.

Note: If you are using Windows, you can use mklink to create soft links.

Release Steps

Create a release on GitHub and name a tag with the version number. For example, if the version number is 1.0.0, the tag name should be 1.0.0 or v1.0.0.

The build script will automatically create a zip file for the release and upload it to the release page.

typecho-plugin-custom-header-footer's People

Contributors

imkero avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.