Skip to content

Instantly share code, notes, and snippets.

View hmowais's full-sized avatar
🎯
Focusing

HM Owais hmowais

🎯
Focusing
  • Karachi, Pakistan
View GitHub Profile
@hmowais
hmowais / functions.php
Last active July 25, 2025 10:08
Multiple Featured Images
<?php
// http://lifeonlars.com/wordpress/how-to-add-multiple-featured-images-in-wordpress/
// https://wp-qa.com/how-to-add-multiple-featured-image-upload-button-without-plugin-for-wordpress
// add these code in functions.php after add_theme_support( 'post-thumbnails' );
add_theme_support( 'post-thumbnails' );
add_image_size( 'case-image', 1371, 893, true );
add_image_size( 'ipad-image', 2383, 1867, true );
add_image_size( 'feature-image', 960, 500, true );
@hmowais
hmowais / custom.css
Last active August 11, 2022 07:38
FAQs Accordions Shortcode with Schema
<style>
/* FAQs Schema Styling */
.accordion__item {
margin: 0px auto 15px;
}
.accordion__item .accordion__title {
position: relative;
display: block;
@hmowais
hmowais / functions.php
Created July 15, 2022 13:16
Nested Bootstrap Accordions Shortcode [CPT and ACF]
<?php
/* FAQs Shortcode */
add_shortcode( 'faqs', 'faqs_shortcode' );
function faqs_shortcode() {
ob_start();
global $post;
@hmowais
hmowais / custom.css
Created July 13, 2022 11:58
Dot Particles Animation CSS
/* Blue */
.dot.blue {
background:#629CD1;
width: 25px;
height: 25px;
left: 95%;
top: 220px;
}
.dot.blue:before {
@hmowais
hmowais / custom.js
Created July 13, 2022 07:08
Add Sticky Header class in Elementor
jQuery( document ).ready(function($) {
jQuery(window).scroll(function($){
if ($(this).scrollTop() > 80) {
$('header.elementor-section').addClass('StickyHeader');
} else {
$('header.elementor-section').removeClass('StickyHeader');
}
});
});
@hmowais
hmowais / custom.css
Created July 8, 2022 12:35
Masking CSS Image
.image img {
-webkit-mask-image: url(https://kit-demos.envalab.com/dikan/wp-content/uploads/2021/08/02_creative-studio.png);
-webkit-mask-size: contain;
-webkit-mask-position: center center;
-webkit-mask-repeat: no-repeat;
}
@hmowais
hmowais / functions.php
Created July 5, 2022 07:10
Add Pakistani Rupees Currency in Gravity Form
<?php
/* Add Pakistani Rupees Currency in Gravity Form */
add_filter( 'gform_currencies', 'add_pkr_currency' );
function add_pkr_currency( $currencies ) {
$currencies['PKR'] = array(
'name' => __( 'Pakistan Rupee', 'gravityforms' ),
'symbol_left' => 'Rs',
'symbol_right' => '',
'symbol_padding' => ' ',
@hmowais
hmowais / functions.php
Created July 5, 2022 06:55
Redirect Condition : User Logged in or Not Logged in
<?php
add_action( 'template_redirect', 'redirect_user' );
function redirect_user() {
if ( is_page('property-listing') && ! is_user_logged_in() ) {
wp_redirect( 'https://www.sunconstruction.com.pk/dev/login/');
exit;
}
if ( is_page('login') && is_user_logged_in() ) {
@hmowais
hmowais / functions.php
Last active June 2, 2022 07:44
Graivty Form Post Creation Hooks
<?php
/* Map Gravity Form Checkbox to ACF Checkbox */
/* with Advanced Post Creation Gravity Form Addon */
/* Reference | https://support.advancedcustomfields.com/forums/topic/check-box-values-from-gravity-form-not-stored-in-acf-check-box/ */
// 5 is Form ID
add_filter( 'gform_advancedpostcreation_post_after_creation_5', 'apc_serialize_checkboxes', 10, 4 );
function apc_serialize_checkboxes( $post_id, $feed, $entry, $form ) {
@hmowais
hmowais / functions.php
Created March 29, 2022 05:37
WordPress Tweaks
<?php
//Wordpress Update version gutenberg editor OFF
add_filter('use_block_editor_for_post', '__return_false', 10);
// Disables the block editor from managing widgets.
add_filter( 'use_widgets_block_editor', '__return_false' );