Skip to content

Instantly share code, notes, and snippets.

View amirhp-com's full-sized avatar
🔥

Amirhossein Hosseinpour amirhp-com

🔥
View GitHub Profile
@amirhp-com
amirhp-com / notion.js
Created April 24, 2025 09:06
Notion RTL Style Injector
/**
* Notion RTL Style Injector
*
* This JavaScript snippet injects RTL (Right-to-Left) styling and a custom Persian font
* into the Notion web app. It applies IranYekanXVF to all text content and ensures proper
* direction for common block types like lists and text blocks.
*
* Usage:
* - Paste this code into your browser console while using Notion.
* - Alternatively, embed it into a userscript extension or a custom Electron wrapper.
@amirhp-com
amirhp-com / index.js
Created April 14, 2025 18:49
Fix SVG Mask ID Conflicts (Elementor)
/**
* Fix SVG Mask ID Conflicts (Elementor & Other Builders)
*
* Problem:
* In page builders like Elementor, the same SVG icon may be reused multiple times.
* When these icons use <mask> elements with the same ID, only the first one renders properly.
* Others (especially on responsive views or repeated widgets) may appear blank or as a square.
*
* Cause:
* Duplicate <mask> IDs cause conflicts in the SVG rendering.
@amirhp-com
amirhp-com / index.md
Last active November 22, 2024 07:18
How to Push a WordPress Plugin to SVN Using macOS Terminal

How to Push a WordPress Plugin to SVN Using macOS Terminal

This step-by-step guide outlines the process of uploading and tagging a WordPress plugin to the WordPress SVN repository using the macOS Terminal. By following these instructions, you'll learn how to prepare your plugin files, commit changes, and properly tag a new release. Let's dive in!


Steps to Push Your Plugin

1. Install SVN on macOS

@amirhp-com
amirhp-com / index.php
Last active November 12, 2024 09:19
Add HTML Block Above Elementor Responsive Mobile Menu
/**
* Add HTML Block Above Elementor Responsive Mobile Menu
* https://www.linkedin.com/posts/activity-7262031237320474624-lMHe
*
* This code snippet adds an HTML block above the Elementor mobile menu
* by hooking into the 'wp_nav_menu' action. It checks if the menu slug
* matches 'mobile-menu' and inserts the HTML block with ID '4444' above
* the menu.
*
* Usage:
@amirhp-com
amirhp-com / index.php
Last active November 10, 2024 23:52
WooCommerce: Add Custom Greeting Card Field in Checkout
<?php
/*
* WooCommerce: Add Custom Greeting Card Field in Checkout
* https://www.linkedin.com/posts/activity-7261525050271399938-Tt24
*
* This code snippet adds a custom textarea field in the WooCommerce checkout page
* for customers to add a personal greeting card message. The message is saved with
* the order, displayed in the admin order edit page, and can be edited by the admin.
*
* Usage:
@amirhp-com
amirhp-com / index.php
Last active December 2, 2024 05:31
WooCommerce: Display In-Stock Products First
<?php
/**
* WooCommerce: Display In-Stock Products First
* https://www.linkedin.com/posts/activity-7254955257355456515-ypfV
*
* This code snippet reorders products in WooCommerce to show
* in-stock items first, followed by out-of-stock items. It uses
* the 'posts_clauses' filter to modify the default product query.
*
* Usage:
@amirhp-com
amirhp-com / method1.php
Last active November 10, 2024 23:57
Fixing SEO Issues in the Woodmart Theme by Converting H3 Tags to P Tags
<?php
/*
:: Fixing SEO Issues in the Woodmart Theme by Converting H3 to P
>> https://www.linkedin.com/posts/activity-7254435929468100608-t3gk
-----------------------------------------------------------------
If you’re using the Woodmart theme and notice h3 tags being used
in places where they shouldn’t be (like regular content sections),
it can hurt your SEO. Here’s a quick PHP solution to dynamically
convert those h3 tags with the class wd-entities-title into p tags,
@amirhp-com
amirhp-com / index.js
Last active November 11, 2024 00:03
Directly Open Print Dialog for a PDF from URL
/*
* Directly Open Print Dialog for a PDF from URL
* https://www.linkedin.com/posts/activity-7242424929344753664-4Zrk
* Developer: Amirhp.com
* Contact: [email protected]
*
* 1. add following iframe and load pdf into it:
* 2. <iframe id="print_pdf_iframe" src="https://site.com/sample.pdf" frameborder="0"></iframe>
* 3. Then for print button, add print_pdf function as command
*/
@amirhp-com
amirhp-com / index.php
Last active November 11, 2024 00:04
Generate a Vertical barcode using Picqer/Barcode and Help of PeproDev Ultimate Invoice for mPDF
<?php
/*
* Generate a Vertical barcode using Picqer/Barcode and Help of PeproDev Ultimate Invoice for mPDF
* https://www.linkedin.com/posts/activity-7241606637805858816-Kg9l
*/
try {
global $PeproUltimateInvoice;
$generator = $PeproUltimateInvoice->barcode;
$barcode_text = "123456789";
$barcode = 'data:image/jpeg;base64,' . base64_encode($generator->getBarcode($barcode_text, $generator::TYPE_CODE_128));;
@amirhp-com
amirhp-com / fix-wc-orders-screen.php
Created July 27, 2024 20:46
Fix WooCommerce Order Screen responsive problem to show full order's details.
<?php
/*
Fix WooCommerce Order Screen responsive problem to show full order's details.
Snippet by Amirhp.Com - Tested on WC 9.1.2 & WP 6.6.1
*/
add_action("manage_shop_order_posts_custom_column", "wc_fix_render_column", 10, 2 );
add_action("manage_woocommerce_page_wc-orders_custom_column", "wc_fix_render_column", 10, 2 );
add_action("admin_enqueue_scripts", "wc_fix_admin_styles");