Skip to content

Instantly share code, notes, and snippets.

View ahmedmusawir's full-sized avatar
:electron:
Working from home

ahmedmusawir

:electron:
Working from home
View GitHub Profile
<?php
$categories = get_the_category();
$separator = ' ';
$output = '';
if($categories){
foreach($categories as $category) {
$output .= '<a href="'.get_category_link( $category->term_id ).'" title="' . esc_attr( sprintf( __( "View all posts in %s" ), $category->name ) ) . '">'.$category->cat_name.'</a>'.$separator;
}
echo trim($output, $separator);
}
@ahmedmusawir
ahmedmusawir / WP_featured_image
Created June 28, 2015 05:29
WP Add Theme Support for Featured Image
@ahmedmusawir
ahmedmusawir / even_odd_posts.php
Created July 23, 2015 11:48
WordPress Even Odd Post Style
<?php
//I will use WP_Query class instance
$args = array( 'post_type' => 'post', 'posts_per_page' => 6 );
//Set up a counter
$counter = 0;
//Preparing the Loop
$query = new WP_Query( $args );
@ahmedmusawir
ahmedmusawir / bootstrap_comment_wp
Created August 3, 2015 14:56
WP Comment Forms for Bootstrap 3x
* just paste the following in functions.php
//for the inputs:
/**
*
* BootStrap Comment Form tweak
*
**/
/* For Inputs */
@ahmedmusawir
ahmedmusawir / stellarum_jquery.js
Created August 23, 2015 14:36
jQuery from Final Foundation: Stellarum Project
// Foundation JavaScript
// Documentation can be found at: http://foundation.zurb.com/docs
jQuery(document).ready(function($) {
$(document).foundation( 'topbar', 'reflow' );
$( 'body' ).fadeIn(2000);
/**
*
@ahmedmusawir
ahmedmusawir / stickynav.js
Created August 31, 2015 08:49
Dynamic Sticky Navigation w/ jQuery
//Sticky navigation
var $targetNav = $( '.navbar-default' );
var navOffSet = $targetNav.offset().top;
// console.log( "Offset Top " + navOffSet );
$( window ). scroll(function(){
@ahmedmusawir
ahmedmusawir / youtube.html
Created September 10, 2015 02:48
YouTube Clean Up
<iframe src="//www.youtube.com/embed/OOe8L_gQXd4?controls=0&showinfo=0&rel=0" height="315" width="420" allowfullscreen="" frameborder="0">
@ahmedmusawir
ahmedmusawir / xampp-vhost-setup
Created September 16, 2015 04:10
XAMPP Virtual Host Setup
F:\xampp\apache\conf
File Name: httpd.conf
* Go all the way to the bottom and paste:
# VirtualHost
Alias /localhost "F:/xampp/htdocs/"
<Directory "F:/xampp/htdocs/">
AllowOverride All
@ahmedmusawir
ahmedmusawir / Custom_Post_Category.php
Created September 19, 2015 06:21
Add Custom Post Type into regular Index and Use Category Archive
add_filter('pre_get_posts', 'query_post_type');
function query_post_type($query) {
if(is_category() || is_tag()) {
$post_type = get_query_var('post_type');
if($post_type)
$post_type = $post_type;
else
$post_type = array('post','cpt'); // replace cpt to your custom post type
$query->set('post_type',$post_type);
return $query;
@ahmedmusawir
ahmedmusawir / underline.css
Created October 11, 2015 05:39
Short Underline for Testimonials or Callouts
img {
margin: 0 auto;
border-radius: 50%;
}
h5 {
padding-bottom: 2rem;
position: relative;
&:after {