This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Retrieve the array key corresponding to the largest element in the array. | |
* | |
* @param {Array.<number>} array Input array | |
* @return {number} Index of array element with largest value | |
*/ | |
function argMax(array) { | |
return array.map((x, i) => [x, i]).reduce((r, a) => (a[0] > r[0] ? a : r))[1]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/* | |
Plugin Name: Admin Columns - Yoast SEO Title Column Editability | |
Version: 1.0 | |
Author URI: AUTHOR_URL | |
License: GPLv2 or later | |
License URI: http://www.gnu.org/licenses/gpl-2.0.html | |
*/ | |
add_filter( 'cac/editable/is_column_editable/column=wpseo-title', '__return_true' ); | |
add_filter( 'cac/editable/editables_data', 'my_plugin_column_seo_title_editability', 10, 2 ); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'cac/storage_models', 'myplugin_cpac_storage_models' ); | |
function myplugin_cpac_storage_models( $storage_models ) { | |
if ( isset( $storage_models['mycpt'] ) ) { | |
unset( $storage_models['mycpt'] ); | |
} | |
return $storage_models; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_enqueue_scripts', 'mytheme_scripts' ); | |
/** | |
* Enqueue Dashicons style for frontend use when enqueuing your theme's style sheet | |
*/ | |
function mytheme_scripts() { | |
wp_enqueue_style( 'mytheme-style', get_stylesheet_uri(), 'dashicons' ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_action( 'wp_enqueue_scripts', 'mytheme_scripts' ); | |
/** | |
* Enqueue Dashicons style for frontend use | |
*/ | |
function mytheme_scripts() { | |
wp_enqueue_style( 'dashicons' ); | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/* | |
Plugin Name: My Plugin | |
*/ | |
/** | |
* Main plugin class | |
*/ | |
class MyPlugin { | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'cac/settings/tab_contents', 'myplugin_cac_tab_contents', 10, 2 ); // All tabs | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'cac/settings/tab_contents/tab=[tabid]', 'myplugin_cac_tab_contents_mytab' ); // Only the [tabid] tab | |
?> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'cac/settings/tabs', 'myplugin_cac_settings_tabs' ); | |
/** | |
* Add the tab | |
*/ | |
function myplugin_cac_settings_tabs( $tabs ) { | |
// Add a tab to the list of Admin Columns settings tabs | |
$tabs['myplugin-information'] = __( 'Am I a wizard?', 'myplugin_textdomain' ); | |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
add_filter( 'cac/settings/tabs', 'myplugin_cac_settings_tabs' ); | |
function myplugin_cac_settings_tabs( $tabs ) { | |
// Possibly modify $tabs | |
return $tabs; | |
} | |
?> |
NewerOlder