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 September 2, 2022 08:02
FLK Portfolio Template
<?php
function scroll_scripts() {
if ( is_page_template( 'template-projects.php' ) ) { ?>
<script>
jQuery( document ).ready(function($) {
jQuery(this).scrollTop(0);
jQuery( "html" ).addClass( "noScroll" );
@hmowais
hmowais / functions.php
Created September 2, 2022 08:00
Add Taxonomy Image to Custom Post Type
<?php
//Add image field in taxonomy page
add_action( 'our_portfolio_category_add_form_fields', 'add_custom_taxonomy_image', 10, 2 );
function add_custom_taxonomy_image ( $taxonomy ) {
?>
<div class="form-field term-group">
<label for="image_id"><?php _e('Image', 'taxt-domain'); ?></label>
<input type="hidden" id="image_id" name="image_id" class="custom_media_url" value="">
@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() ) {