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 / toTop_button.php
Last active June 15, 2019 10:09
Add toTop Button with WordPress Hook
<?php
// Add scripts to wp_footer()
function totop_script() { ?>
<script>
jQuery(function ($) {
var $window = $(window);
var $buttonTop = $('.button-top');
var scrollTimer;
@hmowais
hmowais / functions.php
Last active November 27, 2019 05:56
add header elements in custom place
<?php
//go to avada-functions.php for more details
function my_custom_head_function_for_avada() {
//echo "<h3>+353 98 66011</h3>";
$phone_number = do_shortcode( Avada()->settings->get( 'header_number' ) );
echo "<h3>" . $phone_number . "</h3>";
}
add_filter( 'avada_logo_append', 'my_custom_head_function_for_avada' );
@hmowais
hmowais / custom.css
Created September 26, 2019 07:04
Different Font-Family for Numeric Values
@font-face {
font-family: 'AlbondigasFree';
font-style: normal;
font-weight: 400;
src: url(../custom-fonts/Albondigas.ttf),local('KeepCalm-Medium');
unicode-range: U+0-2f, U+40-10FFFF;
}
@hmowais
hmowais / custom.js
Last active October 1, 2019 07:55
Add Type Writing Effects with JQuery
/* TypeWriter Script */
jQuery(document).ready(function(e) {
var TxtType = function(el, toRotate, period) {
this.toRotate = toRotate;
this.el = el;
this.loopNum = 0;
this.period = parseInt(period, 10) || 2000;
this.txt = '';
this.tick();
@hmowais
hmowais / functions.php
Created October 18, 2019 05:02
Show Woocommerce Product Variation Label in Dropdown list
add_filter( 'woocommerce_dropdown_variation_attribute_options_args', 'dropdown_label', 10 );
function dropdown_label( $args ) {
$var_tax = wc_attribute_label( $args['attribute']);
$args['show_option_none'] = apply_filters( 'the_title', $var_tax );
return $args;
}
@hmowais
hmowais / plugin-functions.php
Created October 28, 2019 08:06
Modify Plugin Function in Theme Functions.php
public function enqueue_scripts() {
// Empty redirect.
$redirect_fail = '';
// Set the redirect URL.
$redirectOnFail = esc_url( apply_filters( 'avwp_redirect_on_fail_link', $redirect_fail ) );
}
@hmowais
hmowais / functions.php
Created November 13, 2019 05:25
Add ACF Images in search results
<?php
global $post;
$terms = get_the_terms( $post->ID, 'stores' );
//$nterms = get_the_terms( $post->ID, 'product_tag' );
foreach ($terms as $term ) {
$store_id = $term->term_id;
//$product_cat_name = $term->name;
break;
}
@hmowais
hmowais / functions.php
Last active November 18, 2019 07:32
show CPT as Shortcode
<?php
/* Show CPT Courses */
// require_once WP_CONTENT_DIR . '/inc/postType.php';
require get_stylesheet_directory() . '/inc/postType.php';
//$course = new JW_Post_Type("course");
//Create Shortcode news_flk
// Shortcode: [course-category cname="development-report"]
@hmowais
hmowais / functions.php
Last active November 21, 2019 12:32
Schema Visual Composer Element
<?php
/**/
// include vc_schema.php file in functions.php
require_once get_template_directory() . '/vc_schema.php';
@hmowais
hmowais / functions.php
Created November 25, 2019 05:38
Disable WordPress Updates
add_filter( 'pre_site_transient_update_core', create_function( '$a', "return null;" ) );
# Disable WP>3.0 plugin updates
remove_action( 'load-update-core.php', 'wp_update_plugins' );
add_filter( 'pre_site_transient_update_plugins', create_function( '$a', "return null;" ) );
# Disable WP>3.0 theme updates
remove_action( 'load-update-core.php', 'wp_update_themes' );
add_filter( 'pre_site_transient_update_themes', create_function( '$a', "return null;" ) );