Skip to content

Instantly share code, notes, and snippets.

View Jobayer-Tuser's full-sized avatar

Md. Jobayer Al Madmud Jobayer-Tuser

View GitHub Profile
@hasinhayder
hasinhayder / docker-compose.yml
Last active January 31, 2025 15:57
Quickly deploy mysql and phpMyAdmin with this docker compose file
services:
mysql:
image: mysql:8.4.3
restart: always
ports:
- 3306:3306
volumes:
- ./mysql:/var/lib/mysql
environment:
- MYSQL_ROOT_PASSWORD=root
// Display custom fields in Woocommerce single product page
add_action( 'woocommerce_single_product_summary', 'wpsh_single_posts_custom_meta_fields', 10 );
function wpsh_single_posts_custom_meta_fields(){
$post_id = get_the_ID();
$post = get_post( $post_id );
// Replace $some_number and some_number with your own field ID-s
// For example: if your field ID is my_field, then replace $some_number with $my_field and some_number with my_field
$some_text = get_post_meta( $post->ID, 'some_text' ); // Text field
$some_textarea = get_post_meta( $post->ID, 'some_textarea' ); // Textarea field
<?php
/**
* Get the file type
*/
$filetype = $_FILES["attached_assignment_files"]["type"];
$allowed_mime_types = get_allowed_mime_types();
print_r(in_array($filetype, $allowed_mime_types));
foreach ($filetype as $key => $value) {