Skip to content

Instantly share code, notes, and snippets.

View hasanm95's full-sized avatar

Hasan Mobarak hasanm95

View GitHub Profile
@hasanm95
hasanm95 / Slider Shortcode
Created August 30, 2016 15:35
Slider shortcode
function slider_shortcode($atts){
extract(shortcode_atts(array(
'count' => '5'
), $atts));
$q = new WP_Query(array('post_type' => 'slider-items', 'posts_per_page' => '3', 'orderby' => 'menu_order', 'order' => 'ASC'));
$list = '<div id="home-slider" class="carousel slide carousel-fade" data-ride="carousel"><div class="carousel-inner">';
$i = 0;
while($q->have_posts()) : $q->the_post();
@hasanm95
hasanm95 / Shortcode finder
Created August 30, 2016 15:45
this shortcode checked that is specific shortcode have in this page or post? . [shortcodefinder find="yourshortcodetag"]
function wpb_find_shortcode($atts, $content=null) {
ob_start();
extract( shortcode_atts( array(
'find' => '',
), $atts ) );
$string = $atts['find'];
$args = array(
's' => $string,
@hasanm95
hasanm95 / Disable shortcode
Created August 30, 2016 15:46
Disable unused shortcod
add_shortcode('shortcodetag', '__return_false');
@hasanm95
hasanm95 / wordpress post share option
Last active September 1, 2016 12:25
wordpress post share option
function share_this($content){
if(is_single()){
$content .= '<div class="share_this">';
$title = get_the_title();
$permalink = get_permalink();
$twitter_handler = (get_option('twitter_handler') ? '&amp;via='.esc_attr(get_option('twitter_handler')) : '');
@hasanm95
hasanm95 / WordPress Comments List
Created September 1, 2016 16:16
Wordpress comments list for homepage
<ol class="commentlist">
<?php
//Gather comments for a specific page/post
$comments = get_comments(array(
'status' => 'approve' //Change this to the type of comments to be displayed
));
$args = array(
'walker' => null,
'max_depth' => '',
@hasanm95
hasanm95 / bootstrap carousel with multiple items - wordpress
Created September 8, 2016 08:56
bootstrap carousel with multiple items in wordpress/ custom post / cmb2( Group field)
@hasanm95
hasanm95 / Breadcumb
Created October 15, 2016 19:42
wordpress breadcumb
//Add this code to functions.php
// Breadcrumbs
function custom_breadcrumbs() {
// Settings
$separator = '/';
$breadcrums_id = 'breadcrumbs';
$breadcrums_class = 'breadcrumbs';
$home_title = 'Home';
@hasanm95
hasanm95 / dynamic portfolio with navigation
Created October 19, 2016 19:36
Dynamic wordpress portfolio section with navigation
//1st register your custom post and taxonomy
//This code for fron-end
<section id="portfolio">
<div class="container">
<div class="row">
<ul class="portfolio-filter text-center">
<li><a class="btn btn-default active" href="#" data-filter="*">All</a></li>
<?php
@hasanm95
hasanm95 / Visual comoposer with param_group
Created November 9, 2016 14:06
Create visual composer with param_group
//Backend visual composer add-on code
vc_map(array(
'name' => 'Accordions',
'base' => 'maxima_accordion',
'category' => 'Maxima',
'params' => array(
array(
'type' => 'textfield',
'name' => __('Title', 'rrf-maxima'),
@hasanm95
hasanm95 / Codestar metabox
Created September 8, 2017 09:59
Basic Codestar metabox Code
function industry_rrfonline_options( $options ) {
$options = array();
$options[] = array(
"id" => "industry_rrfonline_slide_meta",
"post_type" => "industry-slide",
'title' => 'Slide Options',
'context' => 'normal',