PHP code example of 10up / wp-framework

1. Go to this page and download the library: Download 10up/wp-framework library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

10up / wp-framework example snippets


namespace YourNamespace;

use TenupFramework\ModuleInterface;
use TenupFramework\Module;

class YourModule implements ModuleInterface {
    use Module;

	public function can_register(): bool {
		return true;
	}

	public function register(): void {
	    // Register hooks and filters here.
	}
}

namespace TenUpPlugin\Posts;

use TenupFramework\PostTypes\AbstractPostType;

class Demo extends AbstractPostType {

	public function get_name() {
		return 'tenup-demo';
	}

	public function get_singular_label() {
		return esc_html__( 'Demo', 'tenup-plugin' );
	}

	public function get_plural_label() {
		return esc_html__( 'Demos', 'tenup-plugin' );
	}

	public function get_menu_icon() {
		return 'dashicons-chart-pie';
	}
}

namespace TenUpPlugin\Posts;

use TenupFramework\PostTypes\AbstractCorePostType;

class Post extends AbstractCorePostType {

	public function get_name() {
		return 'post';
	}

	public function get_supported_taxonomies() {
		return [];
	}

	public function after_register() {
		// Do nothing.
	}
}

namespace TenUpPlugin\Taxonomies;

use TenupFramework\Taxonomies\AbstractTaxonomy;

class Demo extends AbstractTaxonomy {

    public function get_name() {
        return 'tenup-demo-category';
    }

    public function get_singular_label() {
        return esc_html__( 'Category', 'tenup-plugin' );
    }

    public function get_plural_label() {
        return esc_html__( 'Categories', 'tenup-plugin' );
    }

    public function get_post_types() {
        return [ 'tenup-demo' ];
    }
}