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 / custom.liquid
Created April 25, 2024 16:11
Get Menu list in shopify code
<div class="sidebar-menu">
<h2>Categories</h2>
<ul class="footer-menu-list">
{% for link in linklists.collection-menu.links %}
<li class="custom-menu-item {{ link.title }}"><a href="{{ link.url }}">{{ link.title }}</a></li>
{% endfor %}
<li class="vieW_more"><a href="/collections/all">View More</a></li>
</ul>
</div>
@hmowais
hmowais / functions.php
Last active February 21, 2024 06:44
Get User Role Field in Woocommerce Product
<?php
// Add meta box to Products post type
function add_product_user_role_meta_box() {
add_meta_box(
'product_user_role_meta_box',
'User Role',
'render_product_user_role_meta_box',
'product',
'side',
@hmowais
hmowais / custom.js
Created November 8, 2023 14:17
Add Class in Section on Scroll
jQuery( document ).ready(function($) {
var sections = $('.animateiT'),
nav = $('.jump-left'),
nav_height = nav.outerHeight();
$(window).on('scroll', function() {
var cur_pos = $(this).scrollTop();
sections.each(function() {
var top = $(this).offset().top - 300;
var bottom = top + $(this).outerHeight();
if (cur_pos >= top && cur_pos <= bottom) {
@hmowais
hmowais / functions.php
Created January 17, 2023 11:22
Plugins and Themes Updates OFF
<?php
// Update OFF
// Remove WP Updates
function remove_core_updates(){
global $wp_version;return(object) array('last_checked'=> time(),'version_checked'=> $wp_version,);
}
//add_filter('pre_site_transient_update_core','remove_core_updates');
add_filter('pre_site_transient_update_plugins','remove_core_updates');
add_filter('pre_site_transient_update_themes','remove_core_updates');
@hmowais
hmowais / functions.php
Created November 24, 2022 19:49
Redirect to specific after form submit
<?php
/* redirect after form submit */
add_action('template_redirect', function() {
// ID of the redirect page
if (!is_page(2904)) {
return;
}
// coming from the checkout, so all is fine
@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 September 2, 2022 08:02
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;