Skip to content

Instantly share code, notes, and snippets.

@raselahmed7
raselahmed7 / enable-masonry.php
Last active August 29, 2015 14:06
Enable masonry form wordpress
add_action( 'wp_enqueue_scripts', 'jk_masonry' );
function jk_masonry() {
wp_enqueue_script( 'jquery-masonry', array( 'jquery' ) );
}
/*
How to use?
$('#container').masonry({ singleMode: true });
<?php
// Provide an example of an "if – elseif - else" control structure that tests if $day is ‘Monday.’ If so, display ‘Today is Monday.’ Repeat the test of each weekday, displaying ‘Today is (name of the week day),’ otherwise display “It is the weekend.”
$dayname = 'Monday';
if($dayname = 'Monday') :
echo 'Today is Monday.';
elseif() :
echo 'Today is ';
<?php
$my_autop_content = get_the_content();
'.wpautop( $my_autop_content ).'
?>
@raselahmed7
raselahmed7 / custom-post-loop-with-pagination.php
Created February 12, 2016 17:52
Custom post loop with pagination
<?php
global $paged;
$posts_per_page = 9;
$settings = array(
'showposts' => $posts_per_page,
'post_type' => 'portfolio',
'orderby' => 'menu_order',
'order' => 'ASC',
'paged' => $paged)
);
@raselahmed7
raselahmed7 / wordpress-cheat-sheet
Created September 24, 2014 06:22
Wordpress cheatsheets
<?php wp_nav_menu( array( 'theme_location' => 'wpj-main-menu', 'menu_id' => 'nav' ) ); ?>
@raselahmed7
raselahmed7 / related-posts.php
Created February 8, 2015 07:12
related-posts.php
@raselahmed7
raselahmed7 / wordpress-dummy-code
Last active November 22, 2016 14:34
Wordpress dummy codes
<?php the_title(); ?>
function theme_latest_jquery() {
wp_enqueue_script('jquery');
}
add_action('init', 'theme_latest_jquery');
jQuery(document).ready(function($){
var deviceAgent = navigator.userAgent.toLowerCase();
var agentID = deviceAgent.match(/(iphone|ipod|ipad)/);
if (agentID) {
// mobile code here
}
});
<?php
if ( ! defined( 'ABSPATH' ) ) { exit; }
function educare_logo_carousel_shortcode( $atts, $content = null ) {
extract( shortcode_atts( array(
'logos' => '',
'count' => '6',
'tablet_count' => '4',
<div class="header-area">
<div class="container">
<div class="row">
<div class="col-md-3">
<div class="logo">
<h2><a href="index.html">Stock</a></h2>
</div>
</div>
<div class="col-md-9">