Categories
blog gallery officialstupid threejs wordpress

Gallery – Space

Never took the time to dissect Three.js gallery code — I used to just grab it and make it work, since I know the craziness of Three.js. But this is the first time I’m really digging into it and adding new features to the Three.js gallery:

  • Video autoplay
  • GIF support
  • WordPress image uploads (automatic)
  • Easily handles 1000+ images with video without killing the browser (will add and test soon)

https://tinyart.sumnima.me – sumnima tiny arts šŸ˜€

TODO

  • glb support
  • live editor for glb size bla bla bla
Categories
blog threejs toy box wordpress

TOY BOX – last update!

I’m just tired now, so everything is totally on hold. This is the last update for this journal.

https://toy.dharan.city/toybox_game/box-pig/

Tools for mobile for better UX. With more better buttons UI

IMG

Categories
blog officialstupid wordpress

Twenty Twenty-Five 1340px

magic number

1340px

#bookmark #2025 #TwentyTwentyFive

Categories
officialstupid wordpress

WordPress . – file name

From:Ā Screenshot-2025-12-04-at-12.36.02.webp
To:Ā Screenshot-2025-12-04-at-12-36-02.webp

// Add this to your plugin - automatically fixes dots in uploaded filenames
add_filter('wp_handle_upload_prefilter', 'dgc_auto_fix_upload_filename');
function dgc_auto_fix_upload_filename($file) {
    $filename = $file['name'];
    
    // Replace all dots in filename (except the last one for extension)
    $last_dot = strrpos($filename, '.');
    if ($last_dot !== false) {
        $name = substr($filename, 0, $last_dot);
        $ext = substr($filename, $last_dot);
        
        // Replace dots with hyphens in the name part
        $fixed_name = str_replace('.', '-', $name);
        $file['name'] = $fixed_name . $ext;
    }
    
    return $file;
}

// Also fix when uploading via media library
add_filter('wp_handle_sideload_prefilter', 'dgc_auto_fix_upload_filename');
Categories
blog wordpress

Plugin Name: Post/Page Specific JS & CSS

/*
Plugin Name: Post/Page Specific JS & CSS
Description: Add JavaScript and CSS to individual posts/pages
Version: 2.0
*/

Download

<?php
/*
Plugin Name: Post/Page Specific JS & CSS
Description: Add JavaScript and CSS to individual posts/pages
Version: 2.0
License: No License
*/

// Add custom field to post editor
add_action('add_meta_boxes', function() {
	// JavaScript box
	add_meta_box('post_js_box', 'Post JavaScript', 'post_js_meta_box', 'post', 'normal', 'high');
	add_meta_box('post_js_box', 'Page JavaScript', 'post_js_meta_box', 'page', 'normal', 'high');
	
	// CSS box
	add_meta_box('post_css_box', 'Post CSS', 'post_css_meta_box', 'post', 'normal', 'high');
	add_meta_box('post_css_box', 'Page CSS', 'post_css_meta_box', 'page', 'normal', 'high');
});

// JavaScript meta box
function post_js_meta_box($post) {
	wp_nonce_field('post_js_nonce', 'post_js_nonce_field');
	$value = get_post_meta($post->ID, '_post_javascript', true);
	echo '<textarea name="post_javascript" style="width:100%;height:150px;font-family:monospace;" placeholder="// Enter JavaScript code here (without <script> tags)">' . esc_textarea($value) . '</textarea>';
	echo '<p><small>Enter JavaScript without <script> tags. jQuery is available if your theme loads it.</small></p>';
	
	// Show jQuery example
	echo '<details style="margin-top:10px;background:#f5f5f5;padding:10px;">';
	echo '<summary style="cursor:pointer;font-weight:bold;">jQuery Example</summary>';
	echo '<pre style="background:#fff;padding:10px;margin-top:5px;">';
	echo "jQuery(document).ready(function($) {\n";
	echo "    // Your jQuery code here\n";
	echo "    $('.post-title').css('color', 'red');\n";
	echo "});";
	echo '</pre>';
	echo '</details>';
}

// CSS meta box
function post_css_meta_box($post) {
	wp_nonce_field('post_css_nonce', 'post_css_nonce_field');
	$value = get_post_meta($post->ID, '_post_css', true);
	echo '<textarea name="post_css" style="width:100%;height:150px;font-family:monospace;" placeholder="/* Enter CSS code here (without <style> tags) */">' . esc_textarea($value) . '</textarea>';
	echo '<p><small>Enter CSS without <style> tags. Use !important if needed to override theme styles.</small></p>';
	
	// Show CSS examples
	echo '<details style="margin-top:10px;background:#f5f5f5;padding:10px;">';
	echo '<summary style="cursor:pointer;font-weight:bold;">CSS Examples</summary>';
	echo '<pre style="background:#fff;padding:10px;margin-top:5px;">';
	echo "/* Change post title color */\n";
	echo ".entry-title {\n";
	echo "    color: #ff0000 !important;\n";
	echo "}\n\n";
	echo "/* Add border to images in this post */\n";
	echo ".post-" . $post->ID . " img {\n";
	echo "    border: 2px solid #ccc;\n";
	echo "    padding: 5px;\n";
	echo "}\n\n";
	echo "/* Make paragraphs larger */\n";
	echo ".post-" . $post->ID . " p {\n";
	echo "    font-size: 18px;\n";
	echo "    line-height: 1.6;\n";
	echo "}";
	echo '</pre>';
	echo '</details>';
}

// Save custom fields
add_action('save_post', function($post_id) {
	// Save JavaScript
	if (isset($_POST['post_js_nonce_field']) && wp_verify_nonce($_POST['post_js_nonce_field'], 'post_js_nonce')) {
		if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;
		if (!current_user_can('edit_post', $post_id)) return;
		
		if (isset($_POST['post_javascript'])) {
			update_post_meta($post_id, '_post_javascript', $_POST['post_javascript']);
		} else {
			delete_post_meta($post_id, '_post_javascript');
		}
	}
	
	// Save CSS
	if (isset($_POST['post_css_nonce_field']) && wp_verify_nonce($_POST['post_css_nonce_field'], 'post_css_nonce')) {
		if (defined('DOING_AUTOSAVE') && DOING_AUTOSAVE) return;
		if (!current_user_can('edit_post', $post_id)) return;
		
		if (isset($_POST['post_css'])) {
			update_post_meta($post_id, '_post_css', $_POST['post_css']);
		} else {
			delete_post_meta($post_id, '_post_css');
		}
	}
});

// Output JavaScript in footer
add_action('wp_footer', function() {
	if (is_singular()) {
		global $post;
		
		// Output JavaScript
		$js = get_post_meta($post->ID, '_post_javascript', true);
		if (!empty($js)) {
			echo "\n<!-- Post-Specific JavaScript -->\n";
			echo "<script>\n";
			echo "(function() {\n";
			echo "try {\n";
			echo stripslashes(trim($js)) . "\n";
			echo "} catch(e) {\n";
			echo "console.error('Post JS Error on post #" . $post->ID . ":', e);\n";
			echo "}\n";
			echo "})();\n";
			echo "</script>\n";
		}
		
		// Output CSS in footer (as fallback)
		$css = get_post_meta($post->ID, '_post_css', true);
		if (!empty($css)) {
			echo "\n<!-- Post-Specific CSS (in footer) -->\n";
			echo "<style>\n";
			echo stripslashes(trim($css)) . "\n";
			echo "</style>\n";
		}
	}
});

// Output CSS in header (primary location)
add_action('wp_head', function() {
	if (is_singular()) {
		global $post;
		$css = get_post_meta($post->ID, '_post_css', true);
		if (!empty($css)) {
			echo "\n<!-- Post-Specific CSS -->\n";
			echo "<style>\n";
			echo stripslashes(trim($css)) . "\n";
			echo "</style>\n";
		}
	}
});

// Add admin styles for better appearance
add_action('admin_head', function() {
	echo '<style>
	.post-js-box textarea,
	.post-css-box textarea {
		background: #f8f8f8;
		border: 1px solid #ddd;
		border-radius: 4px;
		padding: 10px;
	}
	.post-js-box textarea:focus,
	.post-css-box textarea:focus {
		background: #fff;
		border-color: #007cba;
		box-shadow: 0 0 0 1px #007cba;
	}
	.post-js-box details,
	.post-css-box details {
		border: 1px solid #ddd;
		border-radius: 4px;
	}
	</style>';
});
Categories
blog ecommerce WooCommerce wordpress

designer.php

When designers start prompting for plugins.Ā groceries-veg-meat.php

Screenshot 2025 11 09 at 10.16.03
Categories
blog wordpress

Protected: GIF + fluent-community

This content is password-protected. To view it, please enter the password below.

Categories
blog wordpress

Protected: tiktok + fluent-community

This content is password-protected. To view it, please enter the password below.

Categories
blog wordpress

blockquote – copy and code style

<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/styles/atom-one-dark.min.css">
<script src="https://cdnjs.cloudflare.com/ajax/libs/highlight.js/11.9.0/highlight.min.js"></script>
<script>
document.addEventListener('DOMContentLoaded', () => {

  function setupCodeBlock(block, lang = '') {
    block.style.position = 'relative';

    // Collect all child lines
    let codeEls = Array.from(block.querySelectorAll('div, p, span'));
    if (codeEls.length === 0) codeEls = [block];

    // Generate raw code text with indentation
    let rawCode = '';
    let indentLevel = 0;
    codeEls.forEach(el => {
      let text = el.textContent.trim();
      if (text.includes('}')) indentLevel = Math.max(indentLevel - 1, 0);
      rawCode += '    '.repeat(indentLevel) + text + '\n'; // 4 spaces per indent
      if (text.includes('{')) indentLevel++;
    });

    // Create <pre><code> for Highlight.js
    const pre = document.createElement('pre');
    const code = document.createElement('code');
    code.className = lang + ' hljs';
    code.textContent = rawCode.replace(/[ā€œā€]/g,'"').replace(/[ā€˜ā€™]/g,"'");
    pre.appendChild(code);

    // Clear old content and append new
    while (block.firstChild) block.removeChild(block.firstChild);
    block.appendChild(pre);

    // Highlight.js
    hljs.highlightElement(code);

    // Create copy button
    const copyBtn = document.createElement('button');
    copyBtn.className = 'copy-btn';
    copyBtn.innerText = 'Copy';
    block.appendChild(copyBtn);

    // Copy button event
    copyBtn.addEventListener('click', () => {
      navigator.clipboard.writeText(code.textContent).then(() => {
        copyBtn.innerText = 'Copied!';
        setTimeout(() => copyBtn.innerText = 'Copy', 1500);
      });
    });
  }

  // Apply to all spoiler-body
  document.querySelectorAll('.spoiler-body').forEach(block => {
    const langSpan = block.closest('.spoiler').querySelector('.spoiler-head span');
    const lang = langSpan ? langSpan.textContent.toLowerCase() : '';
    setupCodeBlock(block, lang);
  });

});
</script>


<style>

.hljs { 
background: transparent;
}
.post-message blockquote,
.spoiler-body {
  background: #0d1117;
  color: #c9d1d9;
  padding: 14px;
  border-radius: 6px;
  line-height: 18px;
  overflow-x: auto;
  tab-size: 4;
  font-family: SFMono-Regular, Consolas, "Liberation Mono", Menlo, monospace;
  font-size: 14px;
  white-space: pre; /* preserve tabs and spaces */
  margin: 1em 0;
  position: relative;
}

 

.post-message blockquote div,
.post-message blockquote p,
.post-message blockquote span,
.spoiler-body div,
.spoiler-body p,
.spoiler-body span {
  margin: 0;
}
#af-wrapper .spoiler .spoiler-body { 
margin: 0px;
}
.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #161b22;
  border: 1px solid #30363d;
  color: #c9d1d9;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease-in-out, background 0.2s;
}

.post-message blockquote:hover .copy-btn,
.spoiler-body:hover .copy-btn,
.copy-btn:hover {
  opacity: 1;
}

.copy-btn:hover {
  background: #21262d;
}




 

.copy-btn {
  position: absolute;
  top: 8px;
  right: 8px;
  background: #161b22;
  border: 1px solid #30363d;
  color: #c9d1d9;
  padding: 4px 10px;
  font-size: 12px;
  border-radius: 6px;
  cursor: pointer;
  opacity: 0;
  transition: opacity 0.2s ease-in-out, background 0.2s;
}

.spoiler-body:hover .copy-btn,
.copy-btn:hover {
  opacity: 1;
}

.copy-btn:hover {
  background: #21262d;
}

</style>
Categories
bigcommerce blog Child theme cms wordpress wordpress

wordpress remove customize section – child theme

stupid like me want such change šŸ˜›

#bookmark #remove #customize #section #wordpress

Ā 

function remove_customize_register() { global $wp_customize; $wp_customize->remove_section( 'colors' ); //Modify this line as needed } add_action( 'customize_register', 'remove_customize_register', 11 );
Categories
blog Storefront WooCommerce wordpress

wordpress woocommerce storefront tab to accordion

tab templates/single-product/tabs

function.php

Ā 

/** * @snippet Move product tabs beside the product image - WooCommerce */ remove_action( 'woocommerce_after_single_product_summary', 'woocommerce_output_product_data_tabs', 10 ); add_action( 'woocommerce_single_product_summary', 'woocommerce_output_product_data_tabs', 60 ); add_filter('woocommerce_product_description_heading', '__return_null'); add_filter('woocommerce_product_additional_information_heading', '__return_null');

This website stores cookies on your computer. These cookies are used to provide a more personalized experience and to track your whereabouts around our website in compliance with the European General Data Protection Regulation. If you decide to to opt-out of any future tracking, a cookie will be setup in your browser to remember this choice for one year.

Accept or Deny