Tag: php
Admin/Floating Toolbar
/** * Create a secondary admin toolbar in the top right with integrated plugin/users search * * @author mccannex * * Changelog * 2024-08-01 – Fixed issue with crashing admin backend because WP core changed priority on certain hooks *…Continue reading
Create List of Child Pages
function wpb_list_child_pages() { global $post; // Only get child pages of the current page $args = array( ‘post_type’ => ‘page’, ‘posts_per_page’ => -1, // get all child pages ‘post_parent’ => $post->ID, ‘orderby’ => ‘menu_order’, ‘order’ => ‘ASC’ ); $child_pages =…Continue reading
Get Blog Info
/** * Function that returns a value from the get_bloginfo() function with a prefix, suffix, and separator. * * @param string $blog_info The blog info to be retrieved. Example: ‘name’, ‘description’, etc. * @param string $prefix The prefix to add…Continue reading
increase upload memory
upload_max_filesize = 256M post_max_size = 256M max_execution_time = 300 />Continue reading
php code
php code
Hide Tickets for members
function my_hide_ticket_by_taxonomy_role( $content ) { if ( is_tax( ‘tribe_events_cat’, ‘301’ ) && ( current_user_can( ‘member_core’ ) || current_user_can( ‘member_writer’ ) ) ) { // Remove the event ticket form $content = preg_replace( ‘//is’, ”, $content ); } return $content; }…Continue reading
WooCommerce – Add multiple products to cart
// Add products to the cart function add_products_to_cart() { // Define the products to be added to the cart $products = array( array( ‘product_id’ => 20070, ‘quantity’ => 1 ), array( ‘product_id’ => 19968, ‘quantity’ => 1 ) ); //…Continue reading