Skip to content

Instantly share code, notes, and snippets.

View ohid's full-sized avatar

Ohidul Islam ohid

View GitHub Profile
@ohid
ohid / PHP Array of Animate.css animation styles
Last active January 5, 2022 17:17
An array of all animation style names from animate.css
$animations = array(
'bounce' => 'bounce',
'flash' => 'flash',
'pulse' => 'pulse',
'rubberBand' => 'rubberBand',
'shake' => 'shake',
'swing' => 'swing',
'tada' => 'tada',
'wobble' => 'wobble',
'jello' => 'jello',
@ohid
ohid / Theme checklist before submission on ThemeForest
Last active December 19, 2016 13:10
A checklist before before publishing a theme on Themeforest
Global should not use outside function. It's a bad practice
Use a unique prefix like themename or framework name
use wp_site_icon
Data validation - esc_html() esc_html__() etc
Page break <!--nextpage--> should work in posts
Latest versions of used plugins
Check theme errors by using - Theme check plugin
Post layout/functionality - sticky post, etc
Use filters body_class, post_class, to add classes
upload_max_filesize = 128M
post_max_size = 64M
memory_limit = 300M
file_uploads = On
max_execution_time = 180
// Markup for HTML
// We will use a class called "custom-spacing" and give some data attributes as we need.
<div class="custom-spacing" data-height="20px" data-padding-left="50px" data-padding-right="50px"></div>
## THE MAGIC PART
// The jQuery code for doing the magic.
// We will loop through all the "custom-spacing" classes and grab there data attributes and set CSS property and value according to it.
<div class="form-group">
[text* name class:form-control placeholder "Your name"]
<div class="form-grad-border"></div>
</div>
<div class="form-group">
[email* email class:form-control placeholder "Your email"]
<div class="form-grad-border"></div>
</div>
<div class="form-group">
[text* subject class:form-control placeholder "Subject"]
<?php
add_action('elementor/element/before_section_end', function( $section, $section_id, $args ) {
if( $section->get_name() == 'section' && $section_id == 'section_layout' ){
$section->add_control(
'wpb_section_padding',
[
'label' => _x( 'Section Padding (top & bottom)', 'Section Control', 'wpb-plugins' ),
'type' => Elementor\Controls_Manager::SELECT,
'options' => [
'default' => _x( 'Default', 'Section Control', 'wpb-plugins' ),
add_action( 'template_redirect', function(){
ob_start( function( $buffer ){
$buffer = str_replace( array( 'type="text/javascript"', "type='text/javascript'" ), '', $buffer );
// Also works with other attributes...
$buffer = str_replace( array( 'type="text/css"', "type='text/css'" ), '', $buffer );
$buffer = str_replace( array( 'frameborder="0"', "frameborder='0'" ), '', $buffer );
$buffer = str_replace( array( 'scrolling="no"', "scrolling='no'" ), '', $buffer );
@ohid
ohid / ip-based-country-redirect.php
Created December 31, 2018 18:33
Client IP based country redirect using PHP
// Function to get the client IP address
function get_client_ip() {
$ipaddress = '';
if (isset($_SERVER['HTTP_CLIENT_IP']))
$ipaddress = $_SERVER['HTTP_CLIENT_IP'];
else if(isset($_SERVER['HTTP_X_FORWARDED_FOR']))
$ipaddress = $_SERVER['HTTP_X_FORWARDED_FOR'];
else if(isset($_SERVER['HTTP_X_FORWARDED']))
$ipaddress = $_SERVER['HTTP_X_FORWARDED'];
else if(isset($_SERVER['HTTP_FORWARDED_FOR']))
@ohid
ohid / pricing.php
Created September 13, 2019 05:36
This file is only modified for xpider-theme-support plugin and can only be used with that.
<?php
namespace xPiderTS\Widgets;
use Elementor\Widget_Base;
use Elementor\Controls_Manager;
use Elementor\Group_Control_Typography;
use Elementor\Group_Control_Background;
use Elementor\Scheme_Typography;
use Elementor\Scheme_Color;
use Elementor\Utils;
// Assume $map looks like this:
$map = array(
array( 'name' => 'Name 1', 'something else' => 'whatever' ),
array( 'name' => 'Name 2', 'something else' => 'whatever' ),
array( 'name' => 'Name 3', 'something else' => 'whatever' ),
array( 'name' => 'Name 4', 'something else' => 'whatever' ),
array( 'name' => 'Name 5', 'something else' => 'whatever' ),
array( 'name' => 'Name 6', 'something else' => 'whatever' ),
array( 'name' => 'Name 7', 'something else' => 'whatever' ),
array( 'name' => 'Name 8', 'something else' => 'whatever' ),