Skip to content

Instantly share code, notes, and snippets.

View arslanfarooq's full-sized avatar

Arslan Farooq arslanfarooq

  • Pakistan
View GitHub Profile
@arslanfarooq
arslanfarooq / gist:2e732c62401c57fc281c
Created April 2, 2015 17:25
WordPress Multiple Loops to Pull Posts
<?php $culture_cat = new WP_Query( 'category_name=culture&posts_per_page=1&orderby=date' );
while ( $culture_cat->have_posts() ) : $culture_cat->the_post();
$do_not_duplicate[] = $post->ID; ?>
<p id="post-<?php the_ID(); ?>">
<a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">
<?php the_title(); ?></a> <small><em><?php the_time('F jS, Y') ?> <!-- by <?php the_author() ?> --></em></small></p>
<?php the_post_thumbnail() ?>
<?php the_excerpt(); ?>
<?php endwhile; ?>
@arslanfarooq
arslanfarooq / sanfrancisco-font.css
Created June 23, 2016 05:13
San Francisco Web Font
/**
* http://applemusic.tumblr.com/
* https://jsfiddle.net/xq56dmrh/
*/
/** Ultra Light */
@font-face {
font-family: "San Francisco";
font-weight: 100;
src: url("https://applesocial.s3.amazonaws.com/assets/styles/fonts/sanfrancisco/sanfranciscodisplay-ultralight-webfont.woff");
<script type="text/javascript">
jQuery(document).ready(function($) {
var ele = $('h3');
ele.each(function() {
$(this).text(toProperCase($(this).text()));
});
function toProperCase(str)
@arslanfarooq
arslanfarooq / modal-video-full.html
Created April 27, 2017 12:39 — forked from anam-hossain/modal-video-full.html
Full example - autoplay youtube video in a Modal (Bootstrap + Jquery)
<html>
<head>
<link rel="stylesheet" href="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/css/bootstrap.min.css">
<script src="https://ajax.googleapis.com/ajax/libs/jquery/1.11.3/jquery.min.js"></script>
<script src="https://maxcdn.bootstrapcdn.com/bootstrap/3.3.4/js/bootstrap.min.js"></script>
<script>
$(function() {
$(".video").click(function () {
var theModal = $(this).data("target"),
videoSRC = $(this).attr("data-video"),
@arslanfarooq
arslanfarooq / 70e04a67f1f5fd96a708.md
Created May 3, 2017 05:25 — forked from oshliaer/70e04a67f1f5fd96a708.md
Extract Gmail content to a spreadsheet #gas #gmail #sheet
@arslanfarooq
arslanfarooq / Extend Recent Posts
Last active March 12, 2018 14:24 — forked from paulruescher/Extend Recent Posts
Used this to change the output of WordPress' Recent Posts Widget
<?php
/**
* Extend Recent Posts Widget
*
* Adds different formatting to the default WordPress Recent Posts Widget
*/
Class My_Recent_Posts_Widget extends WP_Widget_Recent_Posts {
function widget($args, $instance) {
@arslanfarooq
arslanfarooq / TileLayer.Common.js
Created April 18, 2018 07:09 — forked from mourner/TileLayer.Common.js
Leaflet shortcuts for common tile providers
// Lefalet shortcuts for common tile providers - is it worth adding such 1.5kb to Leaflet core?
L.TileLayer.Common = L.TileLayer.extend({
initialize: function (options) {
L.TileLayer.prototype.initialize.call(this, this.url, options);
}
});
(function () {
@arslanfarooq
arslanfarooq / for-include-or-functions.php
Created May 2, 2018 05:49 — forked from carasmo/for-include-or-functions.php
Add Custom Post Type and Taxonomy Terms to wp_link_query. Link search function in WordPress editor add Custom Post Types and Taxonomy Terms
<?php
//don't re add the php tag above
add_filter('wp_link_query', 'cab_add_custom_post_type_archive_link', 10, 2);
/**
* Add Custom Post Type archive to WordPress search link query
* Author: https://github.com/mthchz/editor-archive-post-link/blob/master/editor-archive-post-link.php
*/
function cab_add_custom_post_type_archive_link( $results, $query ) {
@arslanfarooq
arslanfarooq / .gitignore
Created December 13, 2018 12:53
My git ignore file
# Images and fonts #
###################
*.jpg
*.jpeg
*.gif
*.png
*.woff
*.woff2
*.ttf
*.otf
wp_enqueue_script( 'theme_js', get_stylesheet_directory_uri() . '/js/custom.js', array( 'jquery' ), '20.4.3.1', true );