Skip to content

Instantly share code, notes, and snippets.

View munirkamal's full-sized avatar
🎯
Focusing

Munir Kamal munirkamal

🎯
Focusing
View GitHub Profile
@munirkamal
munirkamal / sumo-snip.js
Created April 9, 2022 10:06
Modify the text of the 'Read more' button in Post Grid Module from Divi Sumo
<script>
var buttons = document.querySelectorAll('.cwp_post_grid .et_pb_button_module_wrapper .et_pb_button');
buttons.forEach((button) => {
button.innerHTML = "Change Button Text Here";
return button;
});
@munirkamal
munirkamal / galleryblock-stack-mobile.css
Created December 14, 2020 08:46
CSS snippet to make gallery block stack on mobile
@media screen and (max-width: 500px) {
.wp-block-gallery .blocks-gallery-item {
width: 100%!important;
margin-right: 0;
}
}
@munirkamal
munirkamal / custom_paragraph_block_placeholder_for_pages.php
Created September 24, 2020 10:32
Gutenberg Snippet: Modify the first paragraph block added by default on pages with a custom placeholder text
function custom_paragraph_placeholder_for_pages() {
//Define your post types to lock for classic editor block. Default CPTs are 'post', 'page'
$post_type_object = get_post_type_object( 'page' );
//Define what blocks you want to lock it for. Here is the list of core blocks:
//https://gist.github.com/munirkamal/0d443605a3273926051c2971d5f3ff84#file-core-blocks-txt
$post_type_object->template = array(
array( 'core/paragraph', array(
'placeholder' => 'my placeholder...',
@munirkamal
munirkamal / core-blocks.txt
Created September 23, 2020 09:17
List of Core Gutenberg Blocks
archives
audio
button
categories
code
column
columns
coverImage
embed
file
@munirkamal
munirkamal / rewrite_code.php
Created April 26, 2019 11:17
My WP blog Rewrite Code
<?php
function my_custom_pt_link( $post_link, $id = 0 ){
$post = get_post($id);
if ( is_object( $post ) ){
$terms = wp_get_object_terms( $post->ID, ‘abc );
if( $terms ){
return str_replace( ‘%abc%’ , $terms[0]->slug , $post_link );
} else {
return str_replace( ‘%abc%’ , 'misc' , $post_link );
}
<?php
//This is just a dummy gist.
echo 'Hello World';
?>
@munirkamal
munirkamal / swiperinit.html
Last active November 17, 2018 12:53 — forked from AminulBD/swiperinit.html
Swiper Initialization with data attribute and Animate.css integrate
<div id="content-carousel" class="content-carousel-widget" data-carousel="swiper">
<!--
You can use: data-items="5" for total items display in single page
data-autoplay="true" or "false" for autoplay.
data-loop="true" or "false" for looping the carousel
data-effect="fade" or "cube" for slide changing effects
data-direction="horizontal" or "vertical" for sliding direction
data-initlal="3" for for first active slide
data-center="true" or "false" for centerize slider
-->
<?php
Kirki::add_panel( 'test_panel', array(
'priority' => 10,
'title' => __( 'My Panel', 'start' ),
) );
Kirki::add_section( 'test_section', array(
'title' => __( 'My Section', 'start' ),
'panel' => 'test_panel',
) );
// shortcode to show the module
function showmodule_shortcode($moduleid) {
extract(shortcode_atts(array('id' =>'*'),$moduleid));
return do_shortcode('[et_pb_section global_module="'.$id.'"][/et_pb_section]');
}
add_shortcode('showmodule', ‘showmodule_shortcode');
<script>
jQuery(document).ready(function( $ ) {
// This is to fix an annoying issue with using Before After image slider module within Tabs Module.
$(".et_pb_tabs_controls li").click(function(){setTimeout(function(){$(window).trigger("resize")},800)})
});
</script>