Skip to content

Instantly share code, notes, and snippets.

View Asikur22's full-sized avatar
๐Ÿ’œ
Web Developer | In Love with WordPress

Asiqur Rahman Asikur22

๐Ÿ’œ
Web Developer | In Love with WordPress
View GitHub Profile
@Asikur22
Asikur22 / customizer.php
Created October 30, 2021 15:16
WP Customize TinyMCE Control
// Copyright Text
$wp_customize->add_setting( 'site_copyright', array(
'sanitize_callback' => 'wp_kses_post',
) );
$wp_customize->add_control( new WP_Customize_TinyMCE_Control( $wp_customize, 'site_copyright', array(
'label' => __( 'Copyright Text', 'hadrian-wholesale' ),
'section' => 'contact_info',
'settings' => 'site_copyright',
'type' => 'textarea',
'input_attrs' => [
@Asikur22
Asikur22 / hooks.php
Last active June 16, 2022 01:43
Disable WordPress Plugin Update Notification
/*
* Disable WordPress Plugin Update Notification
*/
function wp98_theme_init() {
add_filter( 'auto_plugin_update_send_email', '__return_false' );
}
add_action( 'init', 'wp98_theme_init' );
/*
@Asikur22
Asikur22 / functions.php
Created September 1, 2021 01:17
Prevent Plugin update notification
/**
* Prevent update notification for plugin
* Place in theme functions.php or at bottom of wp-config.php
*/
function disable_plugin_updates( $value ) {
if ( isset($value) && is_object($value) ) {
$plugins = array('elementor/elementor.php', 'elementor-pro/elementor-pro.php');
foreach($plugins as $plugin){
if ( isset( $value->response[$plugin] ) ) {
@Asikur22
Asikur22 / tinker-post-config.sh
Created August 30, 2021 16:44 — forked from hartraft/tinker-post-config.sh
Configuration script after installing TinkerOS on ASUS Tinkerboard
#!/bin/bash
# My custom script to configuring TinkerOS post install as a desktop replacement. For personal use
sudo apt-get update
# disable swap to reduce SD card wear
sudo swapoff -a
# Setup numlockx for default numlock on at startup
sudo apt-get install numlockx
@Asikur22
Asikur22 / functions.php
Created August 19, 2021 22:30
Add Field to Product Quick/Bulk Edit
function ws365150_custom_edit_box() {
global $post;
?>
<div class="inline-edit-group wc-shipping-text">
<label>
<span class="title">Shipping Text</span>
<span class="input-text-wrap">
<input type="text" name="_shipping_text" value="<?php echo get_post_meta( $post->ID, '_shipping_text', true ); ?>">
</span>
</label>
@Asikur22
Asikur22 / bash.sh
Last active September 13, 2021 21:16
Batch Convert Files
# Convert .svg
convertsvgto(){
EXT=$1;
if [[ -z "$EXT" ]]; then
EXT="jpg";
fi
for file in *.svg; do echo "Converting ${file%.*} Image to $EXT"; convert $file "${file%.*}"."$EXT"; done;
echo "Convert Successful..."
}
@Asikur22
Asikur22 / hooks.php
Created March 17, 2021 09:21
Modify Gutenberg Block Content #RowColumns #render_block
function modify_gutenberg_column_block( $block_content, $block ) {
if ( $block['blockName'] == 'core/columns' ) {
$block_content = str_replace( 'wp-block-columns', 'row', $block_content );
$block_content = '<div class="container">' . $block_content . '</div>';
}
if ( $block['blockName'] == 'core/column' ) {
$block_content = str_replace( 'wp-block-column', 'col', $block_content );
}
@Asikur22
Asikur22 / hooks.php
Created March 15, 2021 07:13
modify elementor content with hooks #elementor #hooks #filterhooks
function modify_post_info_content( $content, $ele ) {
$name = $ele->get_name();
if ( $name == 'post-info' ) {
$settings = $ele->get_settings_for_display();
if ( ! empty( $settings['icon_list'] ) ) {
foreach ( $settings['icon_list'] as $repeater_item ) {
if ( $repeater_item['type'] == 'terms' ) {
$content = str_replace( ',', '', $content );
}
}
@Asikur22
Asikur22 / functions.php
Created February 25, 2021 21:34
Menu Item Description
function be_header_menu_desc( $item_output, $item ) {
if ( $item->description ) {
$item_output = str_replace( '</a>', '</a><div class="description">' . apply_shortcodes( $item->description ) . '</div>', $item_output );
}
return $item_output;
}
add_filter( 'walker_nav_menu_start_el', 'be_header_menu_desc', 10, 2 );
@Asikur22
Asikur22 / functions.php
Created February 24, 2021 10:53
WP Add image alt text to all product page image.
/*
* Add image alt text to product page.
*/
function theme_wp_get_attachment_image_attributes( $attr ) {
if ( ! is_admin() && is_product() ) {
$attr['alt'] = get_the_title();
}
return $attr;
}