mods in the comments header, date and version number
This commit is contained in:
parent
fef643345c
commit
e3936a91a0
|
@ -1,57 +1,46 @@
|
||||||
<?php
|
<?php
|
||||||
/**
|
/**
|
||||||
* The plugin bootstrap file
|
* Plugin Name
|
||||||
*
|
*
|
||||||
* This file is read by WordPress to generate the plugin information in the plugin
|
* @package Biofriction - website options
|
||||||
* admin area. This file also includes all of the dependencies used by the plugin,
|
* @author jorge - vitrubio.net
|
||||||
* registers the activation and deactivation functions, and defines a function
|
* @copyright 2021 jorge - vitrubio.net & hangar.org
|
||||||
* that starts the plugin.
|
* @license GPL-3.0-or-later
|
||||||
*
|
|
||||||
* @link http://example.com
|
|
||||||
* @since 1.0.0
|
|
||||||
* @package Plugin_Name
|
|
||||||
*
|
*
|
||||||
* @wordpress-plugin
|
* @wordpress-plugin
|
||||||
*/
|
* Plugin Name: Biofriction - website options
|
||||||
|
* Plugin URI: https://git.hangar.org/hangar-tech/biofriction-wp-plugin
|
||||||
/*
|
* Description: All the <strong>options</strong> for <strong>Biofriction website</strong> wich do not come by default with wordpress such as: selector for showing buttons, a date picker for old posts, and any other needs.
|
||||||
Plugin Name: Biofriction - website options
|
* Version: 0.4
|
||||||
Plugin URI: https://biofriction.org/
|
* Date: 2021 11 24
|
||||||
Description: All the <strong>options</strong> for <strong>Biofriction website</strong> wich do not come by default with wordpress such as: selector for showing buttons, a date picker for old posts, and any other needs.
|
* Requires at least: 5.2
|
||||||
Version: 0.3
|
* Requires PHP: 7.2
|
||||||
Author URI: https://vitrubio.net/
|
* Author: jorge - vitrubio.net
|
||||||
Author: jorge - vitrubio.net
|
* Author URI: https://vitrubio.net/
|
||||||
License: GPL 3.0
|
* Text Domain: bfr_plugin_txtdomain
|
||||||
Date: 2020 02 10
|
* Domain Path: /languages
|
||||||
License URI:https://www.gnu.org/licenses/gpl-3.0.html
|
* License: GPL 3.0
|
||||||
Text Domain: bfr_plugin_txtdomain
|
* License URI: https://www.gnu.org/licenses/gpl-3.0.html
|
||||||
Domain Path: /languages
|
* Update URI: https://git.hangar.org/hangar-tech/biofriction-wp-theme.git
|
||||||
*/
|
*/
|
||||||
|
|
||||||
/*
|
/*
|
||||||
if ever read this never forget to check
|
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://developer.wordpress.org/plugins/
|
||||||
and the best practices
|
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/
|
|
||||||
*/
|
*/
|
||||||
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
||||||
|
|
||||||
/* *
|
// Load translation, if it exists
|
||||||
* Load translation, if it exists
|
|
||||||
* * * * * * * * * * * * * * * * * * */
|
|
||||||
|
|
||||||
function bfr_plugin_init() {
|
function bfr_plugin_init() {
|
||||||
$plugin_dir = basename(dirname(__FILE__));
|
$plugin_dir = basename(dirname(__FILE__));
|
||||||
load_plugin_textdomain( 'bfr_plugin_txtdomain', null, $plugin_dir.'/assets/languages/' );
|
load_plugin_textdomain( 'bfr_plugin_txtdomain', null, $plugin_dir.'/assets/languages/' );
|
||||||
}
|
}
|
||||||
add_action('plugins_loaded', 'bfr_plugin_init');
|
add_action('plugins_loaded', 'bfr_plugin_init');
|
||||||
|
|
||||||
/* *
|
// add settings link in pluggin page
|
||||||
* add settings link in pluggin page
|
|
||||||
* * * * * * * * * * * * * * * * * * */
|
|
||||||
function bfr_plugin_plugin_action_links($links, $file) {
|
function bfr_plugin_plugin_action_links($links, $file) {
|
||||||
$this_plugin = basename(plugin_dir_url(__FILE__)) . '/bfr-theme-plugin.php';
|
$this_plugin = basename(plugin_dir_url(__FILE__)) . '/bfr-theme-plugin.php';
|
||||||
if($file == $this_plugin) {
|
if($file == $this_plugin) {
|
||||||
|
@ -61,23 +50,16 @@ defined( 'ABSPATH' ) or die( 'No script kiddies please!' );
|
||||||
}
|
}
|
||||||
add_filter('plugin_action_links', 'bfr_plugin_plugin_action_links', 10, 2);
|
add_filter('plugin_action_links', 'bfr_plugin_plugin_action_links', 10, 2);
|
||||||
|
|
||||||
/**
|
// Registers stylesheet for a custom plugin.
|
||||||
* Registers stylesheet for a custom plugin.
|
|
||||||
*/
|
|
||||||
function biofriction_theme_plugin_styles_admin() {
|
function biofriction_theme_plugin_styles_admin() {
|
||||||
add_editor_style( 'assets/css/bfr-theme-plugin.css' );
|
add_editor_style( 'assets/css/bfr-theme-plugin.css' );
|
||||||
}
|
}
|
||||||
add_action( 'admin_init', 'biofriction_theme_plugin_styles_admin' );
|
add_action( 'admin_init', 'biofriction_theme_plugin_styles_admin' );
|
||||||
|
|
||||||
/**
|
// enqueue scripts and styles
|
||||||
* Proper way to enqueue scripts and styles
|
|
||||||
*/
|
|
||||||
function biofriction_theme_plugin_styles_public() {
|
function biofriction_theme_plugin_styles_public() {
|
||||||
$this_plugin = basename(plugin_dir_url(__FILE__));
|
wp_enqueue_style( 'bfr-theme-plugin', plugin_dir_url(__FILE__) . 'assets/css/bfr-theme-plugin.css' , array(), filemtime( plugin_dir_url(__FILE__) . 'assets/css/bfr-theme-plugin.css' ), 'all');
|
||||||
wp_enqueue_style( 'bfr-theme-plugin', plugin_dir_url(__FILE__) . 'assets/css/bfr-theme-plugin.css' );
|
|
||||||
// wp_enqueue_script( 'script-name', get_template_directory_uri() . '/js/example.js', array(), '1.0.0', true );
|
|
||||||
}
|
}
|
||||||
|
|
||||||
add_action( 'wp_enqueue_scripts', 'biofriction_theme_plugin_styles_public' );
|
add_action( 'wp_enqueue_scripts', 'biofriction_theme_plugin_styles_public' );
|
||||||
|
|
||||||
/* *
|
/* *
|
||||||
|
@ -286,16 +268,10 @@ function bfr_field_olderthandate_cb( $args ) {
|
||||||
$position = '50'// $position
|
$position = '50'// $position
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
// register our bfr_options_page to the admin_menu action hook
|
||||||
/**
|
|
||||||
* register our bfr_options_page to the admin_menu action hook
|
|
||||||
*/
|
|
||||||
add_action( 'admin_menu', 'bfr_options_page' );
|
add_action( 'admin_menu', 'bfr_options_page' );
|
||||||
|
|
||||||
/**
|
// top level menu: callback functions
|
||||||
* top level menu:
|
|
||||||
* callback functions
|
|
||||||
*/
|
|
||||||
function bfr_options_page_html() {
|
function bfr_options_page_html() {
|
||||||
// check user capabilities
|
// check user capabilities
|
||||||
if ( ! current_user_can( 'manage_options' ) ) {
|
if ( ! current_user_can( 'manage_options' ) ) {
|
||||||
|
@ -335,3 +311,6 @@ function bfr_options_page_html() {
|
||||||
</div>
|
</div>
|
||||||
<?php
|
<?php
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Randomize images in gallery homepage
|
||||||
|
// https://plugins.trac.wordpress.org/browser/random-gallery/trunk/random-gallery.php
|
||||||
|
|
Loading…
Reference in New Issue