Skip to content

Instantly share code, notes, and snippets.

View imuhammadshoaib's full-sized avatar
🎯
Focusing

Muhammad Shoaib imuhammadshoaib

🎯
Focusing
View GitHub Profile
@imuhammadshoaib
imuhammadshoaib / function.php
Created December 24, 2019 12:58
Show tag in Product Archive
<?php
add_filter( 'the_title', 'mycode_add_brand_to_product_title', 10, 2 );
function mycode_add_brand_to_product_title( $title, $post_id ) {
if ( get_post_type( $post_id ) != 'product' && ! is_archive() )
return $title;
if ( ! ( is_shop() || is_product_category() || is_product_tag() ) )
return $title;
@imuhammadshoaib
imuhammadshoaib / script.js
Created December 20, 2019 12:08
On Click remove Focus and on Keypress Focus appear
jQuery('*').click(function (){
jQuery(this).blur();
});
@imuhammadshoaib
imuhammadshoaib / function.php
Created December 10, 2019 15:15 — forked from dasbairagya/function.php
short code to get the woocommerce recently viewed products
//short code to get the woocommerce recently viewed products
<?php function custom_track_product_view() {
if ( ! is_singular( 'product' ) ) {
return;
}
global $post;
if ( empty( $_COOKIE['woocommerce_recently_viewed'] ) )
$viewed_products = array();
@imuhammadshoaib
imuhammadshoaib / delete.component.ts
Created December 5, 2019 10:53
Delete Fucnton Angular 8
removeSelectedRows(rowData) {
let checkDeleteIndexFind: boolean = false;
let loopFinished = false;
for (let a = 0; a < this.dataSource.data.length; a++) {
if (this.dataSource.data[a].Sequence == rowData.Sequence) {
this.dataSource.data.splice(a, 1);
checkDeleteIndexFind = true;
break;
}
@imuhammadshoaib
imuhammadshoaib / input-component.css
Created November 28, 2019 10:08
Angular Input Outline Color
::ng-deep .mat-step-header .mat-step-icon-selected, .mat-step-header .mat-step-icon-state-done, .mat-step-header .mat-step-icon-state-edit {
background-color: blue!important;
}
::ng-deep .mat-form-field-appearance-outline .mat-form-field-outline {
color: green!important;
/*opacity: 1!important;*/
}
::ng-deep .mat-form-field-appearance-outline.mat-focused .mat-form-field-outline-thick {
@imuhammadshoaib
imuhammadshoaib / BootstrapCarousel.js
Last active August 23, 2019 12:23
Maximum height will apply on all divs. Bootstrap Carousel
$(document).ready(function() {
var maxHeight = 0;
$(".testimonials-contents").each(function(){
if ($(this).height() > maxHeight) { maxHeight = $(this).height(); }
});
$(".testimonials-contents").height(maxHeight);
@imuhammadshoaib
imuhammadshoaib / SLICK Slider
Created June 29, 2019 09:32
SLICK Slider focus on keypress
var $carousel = $('.lightbox-gallery__slider');
$(document).on('keydown', function(e) {
if(e.keyCode == 37) {
$carousel.slick('slickPrev');
}
if(e.keyCode == 39) {
$carousel.slick('slickNext');
}
});
@imuhammadshoaib
imuhammadshoaib / DiviNav.js
Created April 30, 2019 08:06
DIVI nav js
<script>
window.onscroll = function() {scrollFunction()};
function scrollFunction() {
if (document.body.scrollTop > 200 || document.documentElement.scrollTop > 200) {
document.getElementById("navobar").style.top = "0";
document.getElementById("navobar").style.display = "block";
} else {
@imuhammadshoaib
imuhammadshoaib / function.php
Created April 8, 2019 07:55
Add Google AdWord code to your theme
<?php
function addword($wp_customize)
{
$wp_customize->add_section("ads", array(
"title" => __("Advertising", "customizer_ads_sections"),
"priority" => 30,
));
$wp_customize->add_setting("ads_code", array(
"default" => "",
"transport" => "postMessage",
@imuhammadshoaib
imuhammadshoaib / breadcrumb.php
Created April 3, 2019 08:00
Breadcrumb without plugin
<?php
function the_breadcrumb() {
echo '<ul id="crumbs">';
if (!is_home()) {
echo '<li><a href="';
echo get_option('home');
echo '">';
echo 'Home';
echo "</a></li>";
if (is_category() || is_single()) {