Skip to content

Instantly share code, notes, and snippets.

@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 / related-posts.php
Created February 8, 2015 07:12
related-posts.php
<?php
$my_autop_content = get_the_content();
'.wpautop( $my_autop_content ).'
?>
@raselahmed7
raselahmed7 / isotope-active.js
Created January 5, 2015 17:36
jQuery isotope filter
jQuery(document).ready(function($){
$(".all-portfolios").isotope({
itemSelector: '.single-portfolio',
layoutMode: 'fitRows',
});
$('ul.filter li').click(function(){
$("ul.filter li").removeClass("active");
$(this).addClass("active");
<?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 ';
@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 / homepage-only
Created September 23, 2014 13:16
Homepage only look wordpress
<?php if( is_home() || is_front_page() ) : ?>
<!-- Homepage Only Code -->
<?php else : ?>
<!-- Other Page Code -->
<?php endif; ?>
@raselahmed7
raselahmed7 / custom-post-query
Created September 23, 2014 02:19
Custom post query with custom field wordpress
<?php
global $post;
$args = array( 'posts_per_page' => 10, 'post_type'=> 'custom-post-type' );
$myposts = get_posts( $args );
foreach( $myposts as $post ) : setup_postdata($post); ?>
<?php
$job_link= get_post_meta($post->ID, 'job_instructions', true);
?>
@raselahmed7
raselahmed7 / jquery-sticky-menu.js
Created September 21, 2014 06:44
jQuery sticky menu
// Sticky Header
$(window).scroll(function() {
if ($(window).scrollTop() > 100) {
$('.main_h').addClass('sticky');
} else {
$('.main_h').removeClass('sticky');
}
});
@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 });