Skip to content

Instantly share code, notes, and snippets.

View gnanasekaran08's full-sized avatar
:octocat:

Gnanasekaran gnanasekaran08

:octocat:
  • Pauple Studios
  • Trichy, Tamilnadu, India
  • X @gnanam08
View GitHub Profile
// default styles for taxonomy summary page
$taxonomy_styles['summary-page'] = '#col-left { display: none; }#col-right { float:none; width: auto; }';
// for create and edit custom taxonomy page
$taxonomy_styles['action-page'] = '#col-right { display: none; }#col-left { float:none; width: auto; }';
$current_page = 'summary-page';
$custom_taxonomy_page = false;
global $current_screen;
if (isset($current_screen) && (isset($current_screen->post_type) && $current_screen->post_type == CUSTOM_POST_TYPE)) {
@gnanasekaran08
gnanasekaran08 / change_key_from_array.php
Created March 23, 2021 05:35
change key from array
$option = change_key($args,'id','name');
function change_key($array, $old_key, $new_key)
{
if (!array_key_exists($old_key, $array)) {
return $array;
}
$keys = array_keys($array);
$keys[array_search($old_key, $keys)] = $new_key;
@gnanasekaran08
gnanasekaran08 / splice_assoc_array.php
Created March 23, 2021 05:32
Splice Associative Array method
$args = splice_associative_array($args, $index, $content);
if (!function_exists('splice_associative_array')) {
function splice_associative_array($original_data, $position, $replacement_array)
{
/**
* Appending the $replacement_array array in $original_data array, set the $position ad -1.
* Add the $replacement_array array in top of the $original_data array, then set the $position as 0.
*
*/