Skip to content

Instantly share code, notes, and snippets.

View wp-kitten's full-sized avatar

Costin wp-kitten

View GitHub Profile
<?php
// Get The Page ID You Need
get_option( 'woocommerce_shop_page_id' );
get_option( 'woocommerce_cart_page_id' );
get_option( 'woocommerce_checkout_page_id' );
get_option( 'woocommerce_pay_page_id' );
get_option( 'woocommerce_thanks_page_id' );
get_option( 'woocommerce_myaccount_page_id' );
get_option( 'woocommerce_edit_address_page_id' );
get_option( 'woocommerce_view_order_page_id' );
/* actions fired when listing/adding/editing posts or pages */
/* admin_head-(hookname) */
add_action( 'admin_head-post.php', 'admin_head_post_editing' );
add_action( 'admin_head-post-new.php', 'admin_head_post_new' );
add_action( 'admin_head-edit.php', 'admin_head_post_listing' );
function admin_head_post_editing() {
echo 'you are editing a post';
}
@wp-kitten
wp-kitten / git_cheat-sheet.md
Created March 8, 2018 07:45 — forked from davfre/git_cheat-sheet.md
git commandline cheat-sheet
@wp-kitten
wp-kitten / rh-get-widget-data-for-all-sidebars.php
Created August 16, 2018 04:11 — forked from kingkool68/rh-get-widget-data-for-all-sidebars.php
WordPress function to get raw widget data for all of the widgets in a given sidebar
<?php
function rh_get_widget_data_for_all_sidebars() {
global $wp_registered_sidebars;
$output = array();
foreach ( $wp_registered_sidebars as $sidebar ) {
if ( empty( $sidebar['name'] ) ) {
continue;
}
$sidebar_name = $sidebar['name'];
@wp-kitten
wp-kitten / rrmdir.php
Created September 29, 2018 11:25 — forked from liconti/rrmdir.php
PHP recursive rmdir
<?php
function rrmdir($path){
if (is_dir($path)) {
array_map( "rrmdir", glob($path . DIRECTORY_SEPARATOR . '{,.[!.]}*', GLOB_BRACE) );
@rmdir($path);
}
else {
@unlink($path);
}
}