Compare commits
No commits in common. "v01.1" and "main" have entirely different histories.
|
@ -7,66 +7,64 @@
|
||||||
* registers the activation and deactivation functions, and defines a function
|
* registers the activation and deactivation functions, and defines a function
|
||||||
* that starts the plugin.
|
* that starts the plugin.
|
||||||
*
|
*
|
||||||
* @link https://arc-hive.zone
|
* @link https://example.com
|
||||||
* @since 1.0.0
|
* @since 1.0.0
|
||||||
* @package arcHIVE_WPPlugin
|
* @package Plugin_Name
|
||||||
*
|
*
|
||||||
* @wordpress-plugin
|
* @wordpress-plugin
|
||||||
* Plugin Name: arcHIVE WP Plugin for theme support
|
|
||||||
* Plugin URI: https://git.hangar.org/arcHIVE-tech/arc-hive-wordpress-plugin
|
|
||||||
* Description: All the <strong>options</strong> for <strong>arcHIVE website</strong> which do not come by default with Wordpress.
|
|
||||||
* Version: 1.1.0
|
|
||||||
* Date: 2022 03 14
|
|
||||||
* Author: Jorge - vitrubio.net
|
|
||||||
* Author URI: https://vitrubio.net/
|
|
||||||
* License: GPL-3.0+
|
|
||||||
* License URI: http://www.gnu.org/licenses/gpl-3.0.html
|
|
||||||
* Text Domain: archive-wpplugin
|
|
||||||
* Domain Path: /languages
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
* Plugin Name: arcHIVE - website options
|
||||||
|
Plugin URI: https://arc-hive.zone/
|
||||||
|
Description: All the <strong>options</strong> for <strong>arcHIVE website</strong> which do not come by default with Wordpress.
|
||||||
|
Version: 0.1
|
||||||
|
Author URI: https://vitrubio.net/
|
||||||
|
Author: jorge - vitrubio.net
|
||||||
|
License: GPL 3.0
|
||||||
|
Date: 2021 04 14
|
||||||
|
License URI:https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
|
Text Domain: arcHIVE_plugin_txtdomain
|
||||||
|
Domain Path: /languages
|
||||||
|
*/
|
||||||
|
|
||||||
|
/**
|
||||||
|
* if ever read this never forget to check
|
||||||
* howto write a pluggin by Wordpress.org
|
* howto write a pluggin by Wordpress.org
|
||||||
* https://codex.wordpress.org/Writing_a_Plugin
|
* https://codex.wordpress.org/Writing_a_Plugin
|
||||||
|
* and the best practices
|
||||||
* https://developer.wordpress.org/plugins/plugin-basics/best-practices/
|
* https://developer.wordpress.org/plugins/plugin-basics/best-practices/
|
||||||
|
* and some resources
|
||||||
* https://themefoundation.com/wordpress-meta-boxes-guide/
|
* https://themefoundation.com/wordpress-meta-boxes-guide/
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// If this file is called directly, abort.
|
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
||||||
if ( ! defined( 'WPINC' ) ) {
|
|
||||||
die;
|
|
||||||
}
|
|
||||||
//defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Currently plugin version.
|
|
||||||
* Start at version 1.0.0 and use SemVer - https://semver.org
|
|
||||||
* Rename this for your plugin and update it as you release new versions.
|
|
||||||
*/
|
|
||||||
define( 'ARCHIVE_WPPLUGIN_VERSION', '1.1.0' );
|
|
||||||
|
|
||||||
/* *
|
/* *
|
||||||
* define Plugin path
|
* Load translation, if it exists
|
||||||
* https://developer.wordpress.org/reference/functions/plugin_dir_path/#comment-1113
|
|
||||||
* * * * * * * * * * * * * * * * * * */
|
* * * * * * * * * * * * * * * * * * */
|
||||||
define( 'ARCHIVE_WPPLUGIN_PATH', plugin_dir_path( __FILE__ ) );
|
|
||||||
|
|
||||||
include( ARCHIVE_WPPLUGIN_PATH . 'includes/arcHIVE-init-textdomain.php');
|
function arcHIVE_plugin_init() {
|
||||||
|
$plugin_dir = basename(dirname(__FILE__));
|
||||||
|
load_plugin_textdomain( 'arcHIVE_plugin_txtdomain', null, $plugin_dir.'/assets/languages/' );
|
||||||
|
}
|
||||||
|
add_action('plugins_loaded', 'arcHIVE_plugin_init');
|
||||||
|
|
||||||
include( ARCHIVE_WPPLUGIN_PATH . 'includes/arcHIVE-enable-svg.php');
|
/* *
|
||||||
|
* Add mimetypes support: svg
|
||||||
|
* * * * * * * * * * * * * * * * * * */
|
||||||
|
|
||||||
|
function arcHIVE_enable_mime_types( $mimes ) {
|
||||||
|
$mimes['svg'] = 'image/svg+xml';
|
||||||
|
return $mimes;
|
||||||
|
}
|
||||||
|
add_filter('upload_mimes', 'arcHIVE_enable_mime_types');
|
||||||
|
|
||||||
|
|
||||||
// disabled for now
|
/**
|
||||||
// include( ARCHIVE_WPPLUGIN_PATH . 'includes/arcHIVE-delete-capabilities.php');
|
* Registers stylesheet for a custom plugin.
|
||||||
// include_once( ARCHIVE_WPPLUGIN_PATH . 'includes/arcHIVE-add-roles.php');
|
*/
|
||||||
|
function arcHIVE_wp_plugin_styles_admin() {
|
||||||
if ( is_admin() ) {
|
add_editor_style( 'assets/css/arcHIVE-wp-plugin.css' );
|
||||||
//include_once( plugin_dir_path( __FILE__ ) . 'includes/arcHIVE-admin-stylesheet.php' );
|
|
||||||
include( ARCHIVE_WPPLUGIN_PATH . 'includes/arcHIVE-admin-stylesheet.php');
|
|
||||||
} else {
|
|
||||||
//include_once( plugin_dir_path( __FILE__ ) . 'includes/arcHIVE-public-stylesheet.php' );
|
|
||||||
include( ARCHIVE_WPPLUGIN_PATH . 'includes/arcHIVE-public-stylesheet.php');
|
|
||||||
}
|
}
|
||||||
|
add_action( 'admin_init', 'arcHIVE_wp_plugin_styles_admin' );
|
||||||
include( ARCHIVE_WPPLUGIN_PATH . 'includes/arcHIVE-custom-post-type-resources.php');
|
|
||||||
|
|
|
@ -0,0 +1,32 @@
|
||||||
|
/* #bfr_meta{
|
||||||
|
overflow: hidden;
|
||||||
|
padding-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
#bfr_meta p{
|
||||||
|
clear: both;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bfr-row-title{
|
||||||
|
display: block;
|
||||||
|
float: left;
|
||||||
|
width: 200px;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bfr-row-content{
|
||||||
|
float: left;
|
||||||
|
padding-bottom: 1em;
|
||||||
|
}
|
||||||
|
|
||||||
|
.bfr-row-content label{
|
||||||
|
display: block;
|
||||||
|
line-height: 1.75em;
|
||||||
|
} */
|
||||||
|
|
||||||
|
.button a, .button a:not(.button) {
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
||||||
|
|
||||||
|
.button a:hover, .button a:not(.button):hover {
|
||||||
|
background-color: transparent !important;
|
||||||
|
}
|
|
@ -1,20 +0,0 @@
|
||||||
/**
|
|
||||||
* admin css styles.
|
|
||||||
*
|
|
||||||
* @link https://arc-hive.zone
|
|
||||||
* @since 1.1.0
|
|
||||||
*
|
|
||||||
* @package archive_wpplugin
|
|
||||||
* @subpackage archive_wpplugin/includes
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* admin css styles.
|
|
||||||
*
|
|
||||||
* This class defines all code necessary to run during the plugin's activation.
|
|
||||||
*
|
|
||||||
* @since 1.1.0
|
|
||||||
* @package archive_wpplugin
|
|
||||||
* @subpackage archive_wpplugin/includes
|
|
||||||
* @author Jorge - vitrubio.net <jorge@vitrubio.net>
|
|
||||||
*/
|
|
|
@ -1,20 +0,0 @@
|
||||||
/**
|
|
||||||
* public css styles.
|
|
||||||
*
|
|
||||||
* @link https://arc-hive.zone
|
|
||||||
* @since 1.1.0
|
|
||||||
*
|
|
||||||
* @package archive_wpplugin
|
|
||||||
* @subpackage archive_wpplugin/includes
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* public css styles.
|
|
||||||
*
|
|
||||||
* This class defines all code necessary to run during the plugin's activation.
|
|
||||||
*
|
|
||||||
* @since 1.1.0
|
|
||||||
* @package archive_wpplugin
|
|
||||||
* @subpackage archive_wpplugin/includes
|
|
||||||
* @author Jorge - vitrubio.net <jorge@vitrubio.net>
|
|
||||||
*/
|
|
|
@ -1,47 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Add roles for users
|
|
||||||
*
|
|
||||||
* @link https://arc-hive.zone
|
|
||||||
* @since 1.1.0
|
|
||||||
*
|
|
||||||
* @package archive_wpplugin
|
|
||||||
* @subpackage archive_wpplugin/includes
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add roles for users
|
|
||||||
*
|
|
||||||
* This class defines all code necessary to run during the plugin's activation.
|
|
||||||
*
|
|
||||||
* @since 1.1.0
|
|
||||||
* @package archive_wpplugin
|
|
||||||
* @subpackage archive_wpplugin/includes
|
|
||||||
* @author Jorge - vitrubio.net <jorge@vitrubio.net>
|
|
||||||
*/
|
|
||||||
|
|
||||||
// create new roles on plugin activation
|
|
||||||
// https://developer.wordpress.org/reference/functions/add_role/
|
|
||||||
function archive_wpplugin_add_roles_on_plugin_activation() {
|
|
||||||
// if ( get_option( 'custom_roles_version' ) < 1 ) {
|
|
||||||
$resourceeditorcapabilities = array(
|
|
||||||
'read' => true,
|
|
||||||
'level_0' => true
|
|
||||||
);
|
|
||||||
$resourceauthorcapabilities = array(
|
|
||||||
'read' => true,
|
|
||||||
'level_0' => true
|
|
||||||
);
|
|
||||||
$resourceauthorcapabilities = array(
|
|
||||||
'read' => true,
|
|
||||||
'level_0' => true
|
|
||||||
);
|
|
||||||
remove_role('archive_resource_editor');
|
|
||||||
add_role( 'archive_resource_editor', 'Resource Editor', $resourceeditorcapabilities );
|
|
||||||
remove_role('archive_resource_author');
|
|
||||||
add_role( 'archive_resource_author', 'Resource Author', $resourceauthorcapabilities );
|
|
||||||
remove_role('archive_resource_contributor');
|
|
||||||
add_role( 'archive_resource_contributor', 'Resource Contributor', $resourcecontributorcapabilities );
|
|
||||||
// update_option( 'custom_roles_version', 1 );}
|
|
||||||
}
|
|
||||||
register_activation_hook( __FILE__, 'archive_wpplugin_add_roles_on_plugin_activation' );
|
|
|
@ -1,26 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Registers admin stylesheet for a custom plugin.
|
|
||||||
*
|
|
||||||
* @link https://arc-hive.zone
|
|
||||||
* @since 1.1.0
|
|
||||||
*
|
|
||||||
* @package archive_wpplugin
|
|
||||||
* @subpackage archive_wpplugin/includes
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registers admin stylesheet for a custom plugin.
|
|
||||||
*
|
|
||||||
* This class defines all code necessary to run during the plugin's activation.
|
|
||||||
*
|
|
||||||
* @since 1.1.0
|
|
||||||
* @package archive_wpplugin
|
|
||||||
* @subpackage archive_wpplugin/includes
|
|
||||||
* @author Jorge - vitrubio.net <jorge@vitrubio.net>
|
|
||||||
*/
|
|
||||||
|
|
||||||
function arcHIVE_wpplugin_admin_styles() {
|
|
||||||
add_editor_style( 'assets/css/arcHIVE-wpplugin-admin-styles.css' );
|
|
||||||
}
|
|
||||||
add_action( 'admin_init', 'arcHIVE_wpplugin_admin_styles' );
|
|
|
@ -1,45 +1,22 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
|
||||||
* Custom post type Resources.
|
|
||||||
*
|
|
||||||
* @link https://arc-hive.zone
|
|
||||||
* @since 1.1.0
|
|
||||||
*
|
|
||||||
* @package archive_wpplugin
|
|
||||||
* @subpackage archive_wpplugin/includes
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Custom post type Resources.
|
|
||||||
*
|
|
||||||
* This class defines all code necessary to run during the plugin's activation.
|
|
||||||
*
|
|
||||||
* @since 1.1.0
|
|
||||||
* @package archive_wpplugin
|
|
||||||
* @subpackage archive_wpplugin/includes
|
|
||||||
* @author Jorge - vitrubio.net <jorge@vitrubio.net>
|
|
||||||
*/
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start custom post types
|
* Start custom post types
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
* https://developer.wordpress.org/plugins/post-types/registering-custom-post-types/
|
|
||||||
* https://developer.wordpress.org/reference/functions/register_post_type/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Register Custom Post Type
|
// Register Custom Post Type
|
||||||
function archive_wpplugin_init_custom_post_resource() {
|
function custom_post_type_resource_arcHIVE() {
|
||||||
|
|
||||||
$labels = array(
|
$labels = array(
|
||||||
'name' => _x( 'Resources', 'Post Type General Name', 'text_domain' ),
|
'name' => _x( 'All resources', 'Post Type General Name', 'text_domain' ),
|
||||||
'singular_name' => _x( 'Resource', 'Post Type Singular Name', 'text_domain' ),
|
'singular_name' => _x( 'Resource', 'Post Type Singular Name', 'text_domain' ),
|
||||||
'menu_name' => __( 'Resources', 'text_domain' ),
|
'menu_name' => __( 'Resources', 'text_domain' ),
|
||||||
'parent_item_colon' => __( 'Parent resources:', 'text_domain' ),
|
'parent_item_colon' => __( 'Parent resources:', 'text_domain' ),
|
||||||
'all_items' => __( 'All the resources', 'text_domain' ),
|
'all_items' => __( 'All the resources', 'text_domain' ),
|
||||||
'view_item' => __( 'Show the resource', 'text_domain' ),
|
'view_item' => __( 'Show the resource', 'text_domain' ),
|
||||||
'add_new_item' => __( 'Add a new resource', 'text_domain' ),
|
'add_new_item' => __( 'Add a new resource', 'text_domain' ),
|
||||||
'add_new' => __( 'Add new resource', 'text_domain' ),
|
'add_new' => __( 'Add new resources', 'text_domain' ),
|
||||||
'edit_item' => __( 'Edit the resource', 'text_domain' ),
|
'edit_item' => __( 'Edit the resource', 'text_domain' ),
|
||||||
'update_item' => __( 'Save the resource', 'text_domain' ),
|
'update_item' => __( 'Save the resource', 'text_domain' ),
|
||||||
'search_items' => __( 'Search the resource', 'text_domain' ),
|
'search_items' => __( 'Search the resource', 'text_domain' ),
|
||||||
|
@ -47,34 +24,23 @@
|
||||||
'not_found_in_trash' => __( 'We couldn\'t find any resource in the bin', 'text_domain' ),
|
'not_found_in_trash' => __( 'We couldn\'t find any resource in the bin', 'text_domain' ),
|
||||||
);
|
);
|
||||||
$rewrite = array(
|
$rewrite = array(
|
||||||
'slug' => 'resource',
|
'slug' => 'resources/%type_resource_arcHIVE%',
|
||||||
);
|
'with_front' => true,
|
||||||
// https://wordpress.stackexchange.com/questions/108338/capabilities-and-custom-post-types#108375
|
'hierarchical' => true,
|
||||||
// https://developer.wordpress.org/reference/functions/register_post_type/#capability_type
|
|
||||||
$capabilities = array(
|
|
||||||
'read' => 'arcHIVE Read resources',
|
|
||||||
'publish_posts' => 'arcHIVE Publish resources',
|
|
||||||
'edit_posts' => 'arcHIVE Edit resources',
|
|
||||||
'edit_published_posts' => 'arcHIVE Edit published resources',
|
|
||||||
'edit_others_posts' => 'arcHIVE Edit others resources',
|
|
||||||
'delete_posts' => 'arcHIVE Delete resources',
|
|
||||||
'delete_published_posts' => 'arcHIVE Delete published resources',
|
|
||||||
'delete_others_posts' => 'arcHIVE Delete others resources',
|
|
||||||
// 'delete_private_posts' => 'archive_delete_private_resources',
|
|
||||||
);
|
);
|
||||||
$args = array(
|
$args = array(
|
||||||
'label' => __( 'archive_resource', 'text_domain' ),
|
'label' => __( 'resource_arcHIVE', 'text_domain' ),
|
||||||
'description' => __( 'Resources', 'text_domain' ),
|
'description' => __( 'Resources arcHIVE', 'text_domain' ),
|
||||||
'labels' => $labels,
|
'labels' => $labels,
|
||||||
'supports' => array( 'title', 'editor', 'thumbnail', 'trackbacks', 'revisions', 'custom-fields', 'page-attributes' ),
|
'supports' => array( 'title', 'editor', 'thumbnail', 'trackbacks', 'revisions', 'custom-fields', 'page-attributes' ),
|
||||||
'taxonomies' => array('archive_resource_category','archive_resource_category'),
|
'taxonomies' => array('post_tag','type_resource_arcHIVE'),
|
||||||
'hierarchical' => true,
|
'hierarchical' => true,
|
||||||
'public' => true,
|
'public' => true,
|
||||||
'show_ui' => true,
|
'show_ui' => true,
|
||||||
'show_in_menu' => true,
|
'show_in_menu' => true,
|
||||||
'show_in_nav_menus' => true,
|
'show_in_nav_menus' => true,
|
||||||
'show_in_admin_bar' => true,
|
'show_in_admin_bar' => true,
|
||||||
'menu_position' => 5,
|
'menu_position' => 15,
|
||||||
'menu_icon' => 'dashicons-book',
|
'menu_icon' => 'dashicons-book',
|
||||||
'can_export' => true,
|
'can_export' => true,
|
||||||
'has_archive' => 'resources',
|
'has_archive' => 'resources',
|
||||||
|
@ -82,65 +48,41 @@
|
||||||
'publicly_queryable' => true,
|
'publicly_queryable' => true,
|
||||||
'capability_type' => 'post',
|
'capability_type' => 'post',
|
||||||
'rewrite' => $rewrite,
|
'rewrite' => $rewrite,
|
||||||
'capabilities' => $capabilities,
|
|
||||||
'map_meta_cap' => true //neded to apply the new capabilities.
|
|
||||||
);
|
);
|
||||||
register_post_type( 'archive_resource', $args );
|
register_post_type( 'resource_arcHIVE', $args );
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hook into the 'init' action
|
|
||||||
add_action( 'init', 'archive_wpplugin_init_custom_post_resource', 0 );
|
|
||||||
|
|
||||||
|
|
||||||
// give capabilities once the custom post id activated
|
|
||||||
function archive_wpplugin_add_caps() {
|
|
||||||
// gets the XX role
|
|
||||||
// $admins = get_role( '' );
|
|
||||||
// $admins->add_cap( );
|
|
||||||
// gets the administrator role
|
|
||||||
|
|
||||||
|
|
||||||
}
|
}
|
||||||
add_action( 'admin_init', 'archive_wpplugin_add_caps');
|
|
||||||
|
|
||||||
|
|
||||||
|
// Hook into the 'init' action
|
||||||
|
add_action( 'init', 'custom_post_type_resource_arcHIVE', 0 );
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Start custom taxonomies
|
* Start custom taxonomies
|
||||||
* ----------------------------------------------------------------------------
|
* ----------------------------------------------------------------------------
|
||||||
* https://developer.wordpress.org/plugins/taxonomies/working-with-custom-taxonomies/
|
|
||||||
* https://developer.wordpress.org/reference/functions/register_taxonomy/
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
// Register Custom Taxonomy Category for Resources
|
// Register Custom Taxonomy
|
||||||
function archive_wpplugin_register_resource_category() {
|
function custom_taxonomy_type_resource_arcHIVE() {
|
||||||
|
|
||||||
$labels = array(
|
$labels = array(
|
||||||
'name' => _x( 'Resources Types', 'Taxonomy General Name', 'text_domain' ),
|
'name' => _x( 'Type of resources arcHIVE', 'Taxonomy General Name', 'text_domain' ),
|
||||||
'singular_name' => _x( 'Type of resource', 'Taxonomy Singular Name', 'text_domain' ),
|
'singular_name' => _x( 'Type of resource arcHIVE', 'Taxonomy Singular Name', 'text_domain' ),
|
||||||
'menu_name' => __( 'Resources Types', 'text_domain' ),
|
'menu_name' => __( 'Type resources arcHIVE', 'text_domain' ),
|
||||||
'all_items' => __( 'All type resources', 'text_domain' ),
|
'all_items' => __( 'All type resources arcHIVE', 'text_domain' ),
|
||||||
'parent_item' => __( 'Parent type resource', 'text_domain' ),
|
'parent_item' => __( 'Parent type resource arcHIVE', 'text_domain' ),
|
||||||
'parent_item_colon' => __( 'Parent type resource:', 'text_domain' ),
|
'parent_item_colon' => __( 'Parent type resource arcHIVE:', 'text_domain' ),
|
||||||
'new_item_name' => __( 'New type resource', 'text_domain' ),
|
'new_item_name' => __( 'New type resource arcHIVE', 'text_domain' ),
|
||||||
'add_new_item' => __( 'Add New type resource', 'text_domain' ),
|
'add_new_item' => __( 'Add New type resource arcHIVE', 'text_domain' ),
|
||||||
'edit_item' => __( 'Edit type resource', 'text_domain' ),
|
'edit_item' => __( 'Edit type resource arcHIVE', 'text_domain' ),
|
||||||
'update_item' => __( 'Update type of resource', 'text_domain' ),
|
'update_item' => __( 'Update type of resource', 'text_domain' ),
|
||||||
'separate_items_with_commas' => __( 'Separate type resource with commas', 'text_domain' ),
|
'separate_items_with_commas' => __( 'Separate type resource arcHIVE with commas', 'text_domain' ),
|
||||||
'search_items' => __( 'Search type of resource', 'text_domain' ),
|
'search_items' => __( 'Search type of resource', 'text_domain' ),
|
||||||
'add_or_remove_items' => __( 'Add or remove type of resource', 'text_domain' ),
|
'add_or_remove_items' => __( 'Add or remove type of resource arcHIVE', 'text_domain' ),
|
||||||
'choose_from_most_used' => __( 'Choose from the most used type of resource', 'text_domain' ),
|
'choose_from_most_used' => __( 'Choose from the most used type of resource arcHIVE', 'text_domain' ),
|
||||||
'not_found' => __( 'Type of resource Not Found', 'text_domain' ),
|
'not_found' => __( 'Type of resource arcHIVE Not Found', 'text_domain' ),
|
||||||
);
|
);
|
||||||
$rewrite = array(
|
$rewrite = array(
|
||||||
'slug' => 'resource-type',
|
'slug' => 'resources',
|
||||||
);
|
|
||||||
$capabilities = array(
|
|
||||||
'manage_terms' => 'arcHIVE Manage resources Types',
|
|
||||||
'edit_terms' => 'arcHIVE Edit resource Types',
|
|
||||||
'delete_terms' => 'arcHIVE Delete resources Types',
|
|
||||||
'assign_terms' => 'arcHIVE Assign resources Types',
|
|
||||||
);
|
);
|
||||||
$args = array(
|
$args = array(
|
||||||
'labels' => $labels,
|
'labels' => $labels,
|
||||||
|
@ -149,85 +91,28 @@ add_action( 'admin_init', 'archive_wpplugin_add_caps');
|
||||||
'show_ui' => true,
|
'show_ui' => true,
|
||||||
'show_admin_column' => true,
|
'show_admin_column' => true,
|
||||||
'show_in_nav_menus' => true,
|
'show_in_nav_menus' => true,
|
||||||
'show_tagcloud' => false,
|
|
||||||
'rewrite' => $rewrite,
|
|
||||||
'capabilities' => $capabilities,
|
|
||||||
'map_meta_cap' => true //neded to apply the new capabilities.
|
|
||||||
|
|
||||||
);
|
|
||||||
register_taxonomy( 'archive_resource_category', array( 'archive_resource' ) , $args );
|
|
||||||
}
|
|
||||||
|
|
||||||
// Hook into the 'init' action
|
|
||||||
add_action( 'init', 'archive_wpplugin_register_resource_category', 0 );
|
|
||||||
|
|
||||||
// Register Custom Taxonomy Tag for Resources
|
|
||||||
function archive_wpplugin_register_resource_tag() {
|
|
||||||
|
|
||||||
$labels = array(
|
|
||||||
'name' => _x( 'Resources Tags', 'Taxonomy General Name', 'text_domain' ),
|
|
||||||
'singular_name' => _x( 'Resource Tag', 'Taxonomy Singular Name', 'text_domain' ),
|
|
||||||
'menu_name' => __( 'Resources Tags', 'text_domain' ),
|
|
||||||
'all_items' => __( 'All resources tags', 'text_domain' ),
|
|
||||||
'parent_item' => __( 'Parent resource tag', 'text_domain' ),
|
|
||||||
'parent_item_colon' => __( 'Parent resource tag:', 'text_domain' ),
|
|
||||||
'new_item_name' => __( 'New resource tag', 'text_domain' ),
|
|
||||||
'add_new_item' => __( 'Add New resource tag', 'text_domain' ),
|
|
||||||
'edit_item' => __( 'Edit resource tag', 'text_domain' ),
|
|
||||||
'update_item' => __( 'Update resource tag', 'text_domain' ),
|
|
||||||
'separate_items_with_commas' => __( 'Separate resource tag with commas', 'text_domain' ),
|
|
||||||
'search_items' => __( 'Search resource tags', 'text_domain' ),
|
|
||||||
'add_or_remove_items' => __( 'Add or remove resource tag', 'text_domain' ),
|
|
||||||
'choose_from_most_used' => __( 'Choose from the most used resource tags', 'text_domain' ),
|
|
||||||
'not_found' => __( 'Resource tag Not Found', 'text_domain' ),
|
|
||||||
);
|
|
||||||
$rewrite = array(
|
|
||||||
'slug' => 'resource-tag',
|
|
||||||
// 'with_front' => false,
|
|
||||||
);
|
|
||||||
$capabilities = array(
|
|
||||||
'manage_terms' => 'arcHIVE Manage resources Tag',
|
|
||||||
'edit_terms' => 'arcHIVE Edit resource Tag',
|
|
||||||
'delete_terms' => 'arcHIVE Delete resources Tag',
|
|
||||||
'assign_terms' => 'arcHIVE Assign resources Tag',
|
|
||||||
);
|
|
||||||
|
|
||||||
$args = array(
|
|
||||||
'labels' => $labels,
|
|
||||||
'hierarchical' => false,
|
|
||||||
'public' => true,
|
|
||||||
'show_ui' => true,
|
|
||||||
'show_admin_column' => true,
|
|
||||||
'show_in_nav_menus' => true,
|
|
||||||
'show_tagcloud' => true,
|
'show_tagcloud' => true,
|
||||||
'rewrite' => $rewrite,
|
'rewrite' => $rewrite,
|
||||||
'capabilities' => $capabilities,
|
|
||||||
'map_meta_cap' => true //neded to apply the new capabilities.
|
|
||||||
);
|
);
|
||||||
register_taxonomy( 'archive_resource_tag', array( 'archive_resource' ) , $args );
|
register_taxonomy( 'type_resource_arcHIVE', array( 'resource_arcHIVE' ), $args );
|
||||||
|
}
|
||||||
|
|
||||||
|
// Hook into the 'init' action
|
||||||
|
add_action( 'init', 'custom_taxonomy_type_resource_arcHIVE', 0 );
|
||||||
|
|
||||||
|
// changing the permalink
|
||||||
|
// http://wordpress.stackexchange.com/questions/108642/permalinks-custom-post-type-custom-taxonomy-post
|
||||||
|
|
||||||
|
function arcHIVE_show_permalinks( $post_link, $id = 0 ){
|
||||||
|
$post = get_post($id);
|
||||||
|
if ( is_object( $post ) && $post->post_type == 'resource_arcHIVE' ){
|
||||||
|
$terms = wp_get_object_terms( $post->ID, 'type_resource_arcHIVE' );
|
||||||
|
if( $terms ){
|
||||||
|
return str_replace( '%type_resource_arcHIVE%' , $terms[0]->slug , $post_link );
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
return $post_link;
|
||||||
|
}
|
||||||
|
add_filter( 'post_type_link', 'arcHIVE_show_permalinks', 1, 2 );
|
||||||
|
|
||||||
// Hook into the 'init' action
|
?>
|
||||||
add_action( 'init', 'archive_wpplugin_register_resource_tag', 0 );
|
|
||||||
|
|
||||||
// changing the permalink
|
|
||||||
// https://wordpress.stackexchange.com/questions/108642/permalinks-custom-post-type-custom-taxonomy-post
|
|
||||||
// change in register_post_type the slug 'rewrite' to this
|
|
||||||
// $rewrite = array(
|
|
||||||
// 'slug' => 'resources/%archive_resource_category%',
|
|
||||||
// 'with_front' => true,
|
|
||||||
// 'hierarchical' => true,
|
|
||||||
// );
|
|
||||||
// uncomment below
|
|
||||||
//
|
|
||||||
// function archive_wpplugin_resource_and_category_permalink( $post_link, $id = 0 ){
|
|
||||||
// $post = get_post($id);
|
|
||||||
// if ( is_object( $post ) && $post->post_type == 'archive_resource' ){
|
|
||||||
// $terms = wp_get_object_terms( $post->ID, 'archive_resource_category' );
|
|
||||||
// if( $terms ){
|
|
||||||
// return str_replace( '%archive_resource_category%' , $terms[0]->slug , $post_link );
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return $post_link;
|
|
||||||
// }
|
|
||||||
// add_filter( 'post_type_link', 'archive_wpplugin_resource_and_category_permalink', 1, 2 );
|
|
||||||
|
|
|
@ -1,59 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Delete capabilities created in development and in plugin removal.
|
|
||||||
*
|
|
||||||
* @link https://arc-hive.zone
|
|
||||||
* @since 1.1.0
|
|
||||||
*
|
|
||||||
* @package archive_wpplugin
|
|
||||||
* @subpackage archive_wpplugin/includes
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Delete capabilities created in development and in plugin removal.
|
|
||||||
*
|
|
||||||
* This class defines all code necessary to run during the plugin's activation.
|
|
||||||
*
|
|
||||||
* @since 1.1.0
|
|
||||||
* @package archive_wpplugin
|
|
||||||
* @subpackage archive_wpplugin/includes
|
|
||||||
* @author Jorge - vitrubio.net <jorge@vitrubio.net>
|
|
||||||
*/
|
|
||||||
|
|
||||||
// Function to delete capabilities
|
|
||||||
// Based on http://chrisburbridge.com/delete-unwanted-wordpress-custom-capabilities/
|
|
||||||
function clean_unwanted_caps() {
|
|
||||||
global $wp_roles;
|
|
||||||
$delete_caps = array(
|
|
||||||
'read_archive_resource',
|
|
||||||
'publish_archive_resources',
|
|
||||||
'edit_archive_resources',
|
|
||||||
'edit_archive_published_resources',
|
|
||||||
'edit_other_archive_resources',
|
|
||||||
'delete_archive_resources',
|
|
||||||
'delete_archive_published_resources',
|
|
||||||
'delete_archive_others_resources',
|
|
||||||
'delete_archive_private_resources',
|
|
||||||
'upload_media_files',
|
|
||||||
'manage_archive_resources_types',
|
|
||||||
'archive_read_resource',
|
|
||||||
'archive_publish_resources',
|
|
||||||
'archive_edit_resources',
|
|
||||||
'archive_edit_published_resources',
|
|
||||||
'archive_edit_other_resources',
|
|
||||||
'archive_delete_resources',
|
|
||||||
'archive_delete_published_resources',
|
|
||||||
'archive_delete_others_resources',
|
|
||||||
'archive_delete_private_resources',
|
|
||||||
'archive_upload_media_files',
|
|
||||||
'archive_manage_resources_types',
|
|
||||||
'archive_manage_resources_types'
|
|
||||||
);
|
|
||||||
foreach ($delete_caps as $cap) {
|
|
||||||
foreach (array_keys($wp_roles->roles) as $role) {
|
|
||||||
$wp_roles->remove_cap($role, $cap);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
add_action( 'admin_init', 'clean_unwanted_caps' );
|
|
||||||
// register_activation_hook( __FILE__, 'archive_wpplugin_add_roles_on_plugin_activation' );
|
|
|
@ -1,27 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Add mimetypes support: svg
|
|
||||||
*
|
|
||||||
* @link https://arc-hive.zone
|
|
||||||
* @since 1.1.0
|
|
||||||
*
|
|
||||||
* @package archive_wpplugin
|
|
||||||
* @subpackage archive_wpplugin/includes
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Add mimetypes support: svg
|
|
||||||
*
|
|
||||||
* This class defines all code necessary to run during the plugin's activation.
|
|
||||||
*
|
|
||||||
* @since 1.1.0
|
|
||||||
* @package archive_wpplugin
|
|
||||||
* @subpackage archive_wpplugin/includes
|
|
||||||
* @author Jorge - vitrubio.net <jorge@vitrubio.net>
|
|
||||||
*/
|
|
||||||
|
|
||||||
function arcHIVE_enable_mime_types( $mimes ) {
|
|
||||||
$mimes['svg'] = 'image/svg+xml';
|
|
||||||
return $mimes;
|
|
||||||
}
|
|
||||||
add_filter('upload_mimes', 'arcHIVE_enable_mime_types');
|
|
|
@ -1,26 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Load translation, if it exists
|
|
||||||
*
|
|
||||||
* @link https://arc-hive.zone
|
|
||||||
* @since 1.1.0
|
|
||||||
*
|
|
||||||
* @package archive_wpplugin
|
|
||||||
* @subpackage archive_wpplugin/includes
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Load translation, if it exists
|
|
||||||
*
|
|
||||||
* This class defines all code necessary to run during the plugin's activation.
|
|
||||||
*
|
|
||||||
* @since 1.1.0
|
|
||||||
* @package archive_wpplugin
|
|
||||||
* @subpackage archive_wpplugin/includes
|
|
||||||
* @author Jorge - vitrubio.net <jorge@vitrubio.net>
|
|
||||||
*/
|
|
||||||
|
|
||||||
function arcHIVE_init_textdomain() {
|
|
||||||
load_plugin_textdomain( 'archive-wpplugin', null, plugin_dir_path( __FILE__ ).'/assets/languages/' );
|
|
||||||
}
|
|
||||||
add_action('plugins_loaded', 'arcHIVE_init_textdomain');
|
|
|
@ -1,26 +0,0 @@
|
||||||
<?php
|
|
||||||
/**
|
|
||||||
* Registers public stylesheet for a custom plugin.
|
|
||||||
*
|
|
||||||
* @link https://arc-hive.zone
|
|
||||||
* @since 1.1.0
|
|
||||||
*
|
|
||||||
* @package archive_wpplugin
|
|
||||||
* @subpackage archive_wpplugin/includes
|
|
||||||
*/
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Registers public stylesheet for a custom plugin.
|
|
||||||
*
|
|
||||||
* This class defines all code necessary to run during the plugin's activation.
|
|
||||||
*
|
|
||||||
* @since 1.1.0
|
|
||||||
* @package archive_wpplugin
|
|
||||||
* @subpackage archive_wpplugin/includes
|
|
||||||
* @author Jorge - vitrubio.net <jorge@vitrubio.net>
|
|
||||||
*/
|
|
||||||
|
|
||||||
function arcHIVE_wpplugin_public_styles() {
|
|
||||||
add_editor_style( 'assets/css/arcHIVE-wpplugin-styles.css' );
|
|
||||||
}
|
|
||||||
add_action( 'admin_init', 'arcHIVE_wpplugin_public_styles' );
|
|
|
@ -0,0 +1,27 @@
|
||||||
|
<!-- as explained here to translate custom post fields -->
|
||||||
|
<!-- https://polylang.pro/doc/the-wpml-config-xml-file/ -->
|
||||||
|
<!-- -->
|
||||||
|
<wpml-config>
|
||||||
|
<custom-fields>
|
||||||
|
<custom-field action="copy">arcHIVE_homehero-checkbox</custom-field>
|
||||||
|
<custom-field action="translate">arcHIVE_post-wysiwygsummary</custom-field>
|
||||||
|
</custom-fields>
|
||||||
|
<!-- <custom-types>
|
||||||
|
<custom-type translate="1">book</custom-type>
|
||||||
|
<custom-type translate="1">DVD</custom-type>
|
||||||
|
</custom-types> -->
|
||||||
|
<!-- <taxonomies>
|
||||||
|
<taxonomy translate="1">genre</taxonomy>
|
||||||
|
</taxonomies> -->
|
||||||
|
<!-- <admin-texts>
|
||||||
|
<key name="tgb_showinhome_hero">
|
||||||
|
<key name="option_name_1" />
|
||||||
|
<key name="option_name_2" />
|
||||||
|
<key name="options_group_1">
|
||||||
|
<key name="sub_option_name_11" />
|
||||||
|
<key name="sub_option_name_12" />
|
||||||
|
</key>
|
||||||
|
</key>
|
||||||
|
<key name="simple_string_option" />
|
||||||
|
</admin-texts> -->
|
||||||
|
</wpml-config>
|
Loading…
Reference in New Issue