Skip to content

Instantly share code, notes, and snippets.

View munirkamal's full-sized avatar
🎯
Focusing

Munir Kamal munirkamal

🎯
Focusing
View GitHub Profile
@munirkamal
munirkamal / Wordpress - Track and Display post views.php
Last active April 12, 2018 23:45
Wordpress snippet to track and display post or page views in your wordpress website without using any plugin.
/*******************************************************/
/ Shared by www.codewordpress.com /
/ Add following code to Function.php file in your theme /
/*******************************************************/
<?php
function getPostViews($postID){
$count_key = 'post_views_count';
$count = get_post_meta($postID, $count_key, true);
if($count==''){
<link rel="import" href="../paper-tabs/paper-tabs.html">
<link rel="import" href="../paper-tabs/paper-tab.html">
<link rel="import" href="../core-pages/core-pages.html">
<polymer-element name="my-element">
<template>
<style>
:host {
position: absolute;
@munirkamal
munirkamal / header.php
Created October 6, 2015 08:50
Underscores default files
<?php
/**
* The Header for our theme.
*
* Displays all of the <head> section and everything up till <div id="main">
*
* @package Underscores.me
* @since Underscores.me 1.0
*/
?><!DOCTYPE html>
<script>
jQuery(document).ready(function( $ ) {
// This is to fix an annoying issue with using Before After image slider module within Tabs Module.
$(".et_pb_tabs_controls li").click(function(){setTimeout(function(){$(window).trigger("resize")},800)})
});
</script>
// shortcode to show the module
function showmodule_shortcode($moduleid) {
extract(shortcode_atts(array('id' =>'*'),$moduleid));
return do_shortcode('[et_pb_section global_module="'.$id.'"][/et_pb_section]');
}
add_shortcode('showmodule', ‘showmodule_shortcode');
<?php
Kirki::add_panel( 'test_panel', array(
'priority' => 10,
'title' => __( 'My Panel', 'start' ),
) );
Kirki::add_section( 'test_section', array(
'title' => __( 'My Section', 'start' ),
'panel' => 'test_panel',
) );
@munirkamal
munirkamal / swiperinit.html
Last active November 17, 2018 12:53 — forked from AminulBD/swiperinit.html
Swiper Initialization with data attribute and Animate.css integrate
<div id="content-carousel" class="content-carousel-widget" data-carousel="swiper">
<!--
You can use: data-items="5" for total items display in single page
data-autoplay="true" or "false" for autoplay.
data-loop="true" or "false" for looping the carousel
data-effect="fade" or "cube" for slide changing effects
data-direction="horizontal" or "vertical" for sliding direction
data-initlal="3" for for first active slide
data-center="true" or "false" for centerize slider
-->
<?php
//This is just a dummy gist.
echo 'Hello World';
?>
@munirkamal
munirkamal / rewrite_code.php
Created April 26, 2019 11:17
My WP blog Rewrite Code
<?php
function my_custom_pt_link( $post_link, $id = 0 ){
$post = get_post($id);
if ( is_object( $post ) ){
$terms = wp_get_object_terms( $post->ID, ‘abc );
if( $terms ){
return str_replace( ‘%abc%’ , $terms[0]->slug , $post_link );
} else {
return str_replace( ‘%abc%’ , 'misc' , $post_link );
}