Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- /* ---------------------------------------------------------------------- */
- /* Columns
- /* ---------------------------------------------------------------------- */
- function framework_one_col_sc( $atts, $content = null ) {
- return '<div class="col-md-12">' . do_shortcode( $content ) . '</div><div class="clearfix"></div>';
- }
- add_shortcode('one_col', 'framework_one_col_sc');
- /* -------------------------------------------------- */
- /* One half
- /* -------------------------------------------------- */
- function framework_one_half_sc( $atts, $content = null ) {
- return '<div class="col-md-6">' . do_shortcode( $content ) . '</div>';
- }
- add_shortcode('one_half', 'framework_one_half_sc');
- function framework_one_twelve_sc( $atts, $content = null ) {
- return '<div class="col-md-2">' . do_shortcode( $content ) . '</div>';
- }
- add_shortcode('one_twelve', 'framework_one_twelve_sc');
- function framework_one_twelve_last_sc( $atts, $content = null ) {
- return '<div class="col-md-2">' . do_shortcode( $content ) . '</div><div class="clearfix"></div>';
- }
- add_shortcode('one_twelve_last', 'framework_one_twelve_last_sc');
- /* -------------------------------------------------- */
- /* One half last
- /* -------------------------------------------------- */
- function framework_one_half_last_sc( $atts, $content = null ) {
- return '<div class="col-md-6">' . do_shortcode( $content ) . '</div><div class="clearfix"></div>';
- }
- add_shortcode('one_half_last', 'framework_one_half_last_sc');
- /* -------------------------------------------------- */
- /* One third
- /* -------------------------------------------------- */
- function framework_one_third_sc( $atts, $content = null ) {
- return '<div class="col-md-4">' . do_shortcode( $content ) . '</div>';
- }
- add_shortcode('one_third', 'framework_one_third_sc');
- /* -------------------------------------------------- */
- /* One third last
- /* -------------------------------------------------- */
- function framework_one_third_last_sc( $atts, $content = null ) {
- return '<div class="col-md-4">' . do_shortcode( $content ) . '</div><div class="clearfix"></div>';
- }
- add_shortcode('one_third_last', 'framework_one_third_last_sc');
- /* -------------------------------------------------- */
- /* One fourth
- /* -------------------------------------------------- */
- function framework_one_fourth_sc( $atts, $content = null ) {
- return '<div class="col-md-3">' . do_shortcode( $content ) . '</div>';
- }
- add_shortcode('one_fourth', 'framework_one_fourth_sc');
- /* -------------------------------------------------- */
- /* One fourth last
- /* -------------------------------------------------- */
- function framework_one_fourth_last_sc( $atts, $content = null ) {
- return '<div class="col-md-3">' . do_shortcode( $content ) . '</div><div class="clearfix"></div>';
- }
- add_shortcode('one_fourth_last', 'framework_one_fourth_last_sc');
- /* -------------------------------------------------- */
- /* Two third
- /* -------------------------------------------------- */
- function framework_two_third_sc( $atts, $content = null ) {
- return '<div class="col-md-8">' . do_shortcode( $content ) . '</div>';
- }
- add_shortcode('two_third', 'framework_two_third_sc');
- /* -------------------------------------------------- */
- /* Two third last
- /* -------------------------------------------------- */
- function framework_two_third_last_sc( $atts, $content = null ) {
- return '<div class="col-md-4">' . do_shortcode( $content ) . '</div><div class="clearfix"></div>';
- }
- add_shortcode('two_third_last', 'framework_two_third_last_sc');
- /* -------------------------------------------------- */
- /* Three fourth
- /* -------------------------------------------------- */
- function framework_three_four_sc( $atts, $content = null ) {
- return '<div class="col-md-9">' . do_shortcode( $content ) . '</div>';
- }
- add_shortcode('three_fourth', 'framework_three_four_sc');
- /* -------------------------------------------------- */
- /* Three fourth last
- /* -------------------------------------------------- */
- function framework_three_fourth_last_sc( $atts, $content = null ) {
- return '<div class="col-md-3">' . do_shortcode( $content ) . '</div><div class="clearfix"></div>';
- }
- add_shortcode('three_fourth_last', 'framework_three_fourth_last_sc');
- /* ---------------------------------------------------------------------- */
- /* Alert Boxes
- /* ---------------------------------------------------------------------- */
- /* -------------------------------------------------- */
- /* Error
- /* -------------------------------------------------- */
- function framework_error_sc( $atts, $content = null ) {
- return '<div class="alert alert-danger alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>' . $content . '</div>';
- }
- add_shortcode('error', 'framework_error_sc');
- /* -------------------------------------------------- */
- /* Success
- /* -------------------------------------------------- */
- function framework_success_sc( $atts, $content = null ) {
- return '<div class="alert alert-success alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>' . $content . '</div>';
- }
- add_shortcode('success', 'framework_success_sc');
- /* -------------------------------------------------- */
- /* Info
- /* -------------------------------------------------- */
- function framework_info_sc( $atts, $content = null ) {
- return '<div class="alert alert-info alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>' . $content . '</div>';
- }
- add_shortcode('info', 'framework_info_sc');
- /* -------------------------------------------------- */
- /* Notice
- /* -------------------------------------------------- */
- function framework_notice_sc( $atts, $content = null ) {
- return '<div class="alert alert-warning alert-dismissable"><button type="button" class="close" data-dismiss="alert" aria-hidden="true">×</button>' . $content . '</div>';
- }
- add_shortcode('notice', 'framework_notice_sc');
- /* ---------------------------------------------------------------------- */
- /* General
- /* ---------------------------------------------------------------------- */
- /* -------------------------------------------------- */
- /* Ads
- /* -------------------------------------------------- */
- function framework_ads_sc( $atts, $content = null ) {
- extract( shortcode_atts( array(
- 'url' => '',
- 'bannerurl' => '',
- ), $atts ) );
- return '<div class="ads group clearfix"><a href="'.esc_attr($url).'" /><img src="'.esc_attr( $bannerurl ).'"></a></div>';
- }
- add_shortcode('ads', 'framework_ads_sc');
- /* -------------------------------------------------- */
- /* Divider
- /* -------------------------------------------------- */
- function framework_divider_sc( $atts, $content = null ) {
- extract( shortcode_atts( array(
- 'style' => ''
- ), $atts ) );
- return '<hr class="' . esc_attr( $style ) . '" />';
- }
- add_shortcode('divider', 'framework_divider_sc');
- /* -------------------------------------------------- */
- /* Button
- /* -------------------------------------------------- */
- function framework_button_sc( $atts, $content = null ) {
- extract( shortcode_atts( array(
- 'url' => '',
- 'size' => '',
- 'style' => ''
- ), $atts ) );
- $output = '<a class="btn ' . esc_attr( $size ) . ' ' . esc_attr( $style ) . '" href="' . esc_attr( $url ) . '">';
- $output .= $content;
- $output .= '</a>';
- return $output;
- }
- add_shortcode('button', 'framework_button_sc');
- /* -------------------------------------------------- */
- /* List
- /* -------------------------------------------------- */
- function framework_list_sc( $atts, $content = null ) {
- extract( shortcode_atts( array(
- 'icon' => '',
- 'style' => ''
- ), $atts ) );
- return '<div class="custom-list ' . esc_attr( $icon ) . ' ' . esc_attr( $style ) . '">' . $content . '</div>';
- }
- add_shortcode('list', 'framework_list_sc');
- /* -------------------------------------------------- */
- /* Quote
- /* -------------------------------------------------- */
- function framework_quote_sc( $atts, $content = null ) {
- extract( shortcode_atts( array(
- 'author' => '',
- 'type' => ''
- ), $atts ) );
- $output = '<blockquote class="' . esc_attr( $type ) . '">';
- $output .= '<p>' . $content . '</p>';
- if( $author )
- $output .= '<small>' . esc_attr( $author ) . '</small>';
- $output .= '</blockquote>';
- return $output;
- }
- add_shortcode('quote', 'framework_quote_sc');
- /* -------------------------------------------------- */
- /* Accordion Content
- /* -------------------------------------------------- */
- function framework_accordion_content_sc( $atts, $content = null ) {
- extract( shortcode_atts( array(
- 'title' => '',
- 'title_size' => 'span'
- ), $atts ) );
- return '<div class="acc"><' . esc_attr( $title_size ) . ' class="acc-trigger"><a href="#">' . esc_attr( $title ) . '</a></' . esc_attr( $title_size ) . '><div class="acc-container"><div class="content">' . do_shortcode( $content ) . '</div></div></div>';
- }
- add_shortcode('accordion_content', 'framework_accordion_content_sc');
- /* -------------------------------------------------- */
- /* Latest Post
- /* -------------------------------------------------- */
- function framework_latest_post_sc( $atts ) {
- extract( shortcode_atts( array(
- 'style' => '',
- 'category' => '',
- 'color' => '',
- 'limit' => '',
- 'thumbnail' => '',
- 'muslimah' =>false
- ), $atts ) );
- $query = new WP_Query(array('category_name' => $category, "posts_per_page"=>$limit));
- $count =1;
- $category_id = get_cat_ID( str_replace("-", " ", $category) );
- $category_link = get_category_link( $category_id );
- $category_feed_link = get_category_feed_link( $category_id,"rss2");
- switch ($style) {
- case 'style1':
- $output = "<div class='".$style." group ".$color." '>";
- $output .= "<div class='group-title'>";
- $output .= " <h2><i class='fa fa-folder-open'></i><a href=$category_link>".str_replace("-", " ", $category)."</a></h2>";
- $output .= " <div class='feed' ><a href=$category_feed_link data-toggle='tooltip' data-placement='left' title='Belangganan kategori ini'><i class='fa fa-rss'></i></a></div>";
- $output .= "</div>";
- $output .= "<div class='group-content'>";
- $output .= "<ul class='style1 articles'>";
- while ($query->have_posts()) : $query->the_post();
- $output .= "<li>";
- if($thumbnail=="yes"){
- $output .= "<figure class='thumbnail'>";
- $postimage = post_image();
- if(!empty($postimage)):
- $output .= "<img src='".resize_image(post_image(),70,70)."' alt='".esc_html(get_the_title())."' width=70 height=70>";
- else:
- $output .= "<img src='".get_template_directory_uri()."/images/placeholder-70.jpg' alt='".esc_html(get_the_title())."' width=70 height=70>";
- endif;
- $output .= "</figure>";
- }
- $output .= "<div class='meta ".(($thumbnail=="yes")?"has-thumb":"")."'>";
- $output .= "<h3><a href='".get_permalink()."' title='".esc_html(get_the_title())."'>".esc_html(get_the_title())."</a></h3>";
- $output .= "<div>";
- $output .= "<span class='time'><i class='fa fa-calendar'></i>".get_the_date('j M Y')."</span>";
- $output .= "<span class='author'><i class='fa fa-user'></i>".get_the_author()."";
- $output .= "</div>";
- if($style=="style2" && $count==1){
- $output .= "<p>".get_the_excerpt()."</p>";
- }
- $output .= "</div>";
- $output .= "</li>";
- $count++;
- endwhile;
- $output .= "</ul></div></div>";
- break;
- case 'style2':
- $styleg="style2 group-content";
- $output = "<div class='style2 group ".$color." '>";
- $output .= "<div class='group-title'>";
- $output .= " <h2><i class='fa fa-folder-open'></i><a href=$category_link>".str_replace("-", " ", $category)."</a></h2>";
- $output .= " <div class='feed' ><a href=$category_feed_link data-toggle='tooltip' data-placement='left' title='Belangganan kategori ini'><i class='fa fa-rss'></i></a></div>";
- $output .= "</div>";
- $output .= "<div class='group-content'>";
- $output .= "<ul class='style2 group-content articles'>";
- while ($query->have_posts()) : $query->the_post();
- if($count==1){
- $output .= "<li class='first'>";
- }else{
- $output .= "<li>";
- }
- if($thumbnail=="yes"){
- $output .= "<figure class='thumbnail'>";
- $postimage = post_image();
- if(!empty($postimage)):
- $thumb = ($count==1)?resize_image(post_image(),310,200):resize_image(post_image(),70,70);
- $output .= "<img src='".$thumb."' alt='".esc_html(get_the_title())."'".(($count==1)?"width=310 height=200":"width=70 height=70").">";
- else:
- $output .= "<img src='".get_template_directory_uri()."/images/".(($count==1)?"placeholder-310.jpg":"placeholder-70.jpg")."' alt='".esc_html(get_the_title())."'>";
- endif;
- $output .= "</figure>";
- }
- $output .= "<div class='meta'>";
- $output .= "<h3><a href='".get_permalink()."' title='".esc_html(get_the_title())."'>".esc_html(get_the_title())."</a></h3>";
- $output .= "<div>";
- $output .= "<span class='time'><i class='fa fa-calendar'></i>".get_the_date('j M Y')."</span>";
- $output .= "<span class='author'><i class='fa fa-user'></i>".get_the_author()."";
- $output .= "</div>";
- if($count==1){
- $output .= "<p>".get_the_excerpt()."</p>";
- }
- $output .= "</div>";
- $output .= "</li>";
- $count++;
- endwhile;
- $output .= "</ul></div></div>";
- break;
- case 'style3':
- $qry[1] = 1;
- $qry[2] = $limit-1;
- $qry['total'] = array_sum($qry);
- $paged = (get_query_var('page')) ? get_query_var('page') : 1;
- $onum = ($qry['total'] * ($paged - 1));
- $type = "post";
- $output = "<div class='style3 group ".$color." ".(($muslimah)?"muslimah":"")."'>";
- $output .= "<div class='group-title'>";
- $output .= " <h2><i class='fa fa-folder-open'></i><a href=".(($muslimah)?"http://www.hasmi.org/halaman-pernik-muslimah/":$category_link).">".str_replace("-", " ", $category)."</a></h2>";
- $output .= " <div class='feed' ><a href=$category_feed_link data-toggle='tooltip' data-placement='left' title='Belangganan kategori ini'><i class='fa fa-rss'></i></a></div>";
- $output .= "</div>";
- $output .= "<div class='group-content'>";
- $output .= "<div class='row'>";
- $offset = ($paged > 1) ? ($onum) : 0;
- query_posts("post_type=$type&category_name=$category&posts_per_page=$qry[total]&paged=$paged&showposts=$qry[1]&offset=$offset");
- $output .= "<div class='col-md-6'>";
- $output .= "<ul class='style2 articles'>";
- if (have_posts()) : while (have_posts()) : the_post();
- $output .= "<li class='first'>";
- $output .= "<figure class='thumbnail'>";
- $postimage = post_image();
- if(!empty($postimage)):
- $output .= "<img src='".resize_image(post_image(),280,200)."' alt='".esc_html(get_the_title())."' width=280 height=200>";
- else:
- $output .= "<img src='".get_template_directory_uri()."/images/placeholder-70.jpg' alt='".esc_html(get_the_title())."'>";
- endif;
- $output .= "</figure>";
- $output .= "<div class='meta'>";
- $output .= "<h3><a href='".get_permalink()."' title='".esc_html(get_the_title())."'>".string_limit_words(esc_html(get_the_title()),8)."</a></h3>";
- $output .= "<div>";
- $output .= "<span class='time'><i class='fa fa-calendar'></i>".get_the_date('j M Y')."</span>";
- $output .= "<span class='author'><i class='fa fa-user'></i>".get_the_author()."";
- $output .= "</div>";
- $output .= "<p>".get_the_excerpt()."</p>";
- $output .= "</div>";
- $output .= "</li>";
- endwhile;endif;
- $output .= "</ul></div>";
- $offset = $qry[1] + (($paged > 1) ? $onum : 0);
- query_posts("post_type=$type&category_name=$category&posts_per_page=$qry[total]&offset=$offset&showposts=$qry[2]");
- $output .= "<div class='col-md-6'>";
- $output .= "<ul class='style1 articles'>";
- if (have_posts()) : while (have_posts()) : the_post();
- $output .= "<li>";
- $output .= "<figure class='thumbnail'>";
- $postimage = post_image();
- if(!empty($postimage)):
- $output .= "<img src='".resize_image(post_image(),70,70)."' alt='".esc_html(get_the_title())."' width=70 height=70>";
- else:
- $output .= "<img src='".get_template_directory_uri()."/images/placeholder-70.jpg' alt='".esc_html(get_the_title())."' width=70 height=70>";
- endif;
- $output .= "</figure>";
- $output .= "<div class='meta'>";
- $output .= "<h3><a href='".get_permalink()."' title='".esc_html(get_the_title())."'>".string_limit_words(esc_html(get_the_title()),8)."</a></h3>";
- $output .= "<div>";
- $output .= "<span class='time'><i class='fa fa-calendar'></i>".get_the_date('j M Y')."</span>";
- $output .= "<span class='author'><i class='fa fa-user'></i>".get_the_author()."";
- $output .= "</div>";
- $output .= "</div>";
- $output .= "</li>";
- endwhile;
- endif;
- $output .= "</ul></div></div></div></div>";
- break;
- case 'style4':
- $style = "style4";
- $styleg = "style1";
- $output = "<div class='style4 group ".$color." '>";
- $output .= "<div class='group-title'>";
- $output .= " <h2><i class='fa fa-folder-open'></i><a href=$category_link>".str_replace("-", " ", $category)."</a></h2>";
- $output .= " <div class='feed' ><a href=$category_feed_link data-toggle='tooltip' data-placement='left' title='Belangganan kategori ini'><i class='fa fa-rss'></i></a></div>";
- $output .= "</div>";
- $output .= "<div class='group-content'>";
- $output .= "<ul class='style1 articles'>";
- while ($query->have_posts()) : $query->the_post();
- $output .= "<li>";
- if($thumbnail=="yes"){
- $output .= "<figure class='thumbnail'>";
- $postimage = post_image();
- if(!empty($postimage)):
- $output .= "<img src='".resize_image(post_image(),70,70)."' alt='".esc_html(get_the_title())."'>";
- else:
- $output .= "<img src='".get_template_directory_uri()."/images/placeholder-70.jpg' alt='".esc_html(get_the_title())."'>";
- endif;
- $output .= "</figure>";
- }
- $output .= "<div class='meta'>";
- $output .= "<h3><a href='".get_permalink()."' title='".esc_html(get_the_title())."'>".esc_html(get_the_title())."</a></h3>";
- $output .= "<div>";
- $output .= "<span class='time'><i class='fa fa-calendar'></i>".get_the_date('j M Y')."</span>";
- $output .= "<span class='author'><i class='fa fa-user'></i>".get_the_author()."";
- $output .= "</div>";
- $output .= "</div>";
- $output .= "</li>";
- endwhile;
- $output .= "</ul></div></div>";
- break;
- case "style5":
- $output = "<div class='".$style." group ".$color." '>";
- $output .= "<div class='group-title'>";
- $output .= " <h2><i class='fa fa-folder-open'></i><a href=$category_link>".str_replace("-", " ", $category)."</a></h2>";
- $output .= " <div class='feed' ><a href=$category_feed_link data-toggle='tooltip' data-placement='left' title='Belangganan kategori ini'><i class='fa fa-rss'></i></a></div>";
- $output .= "</div>";
- $output .= "<div class='group-content'>";
- $output .= "<ul class='style1 articles'>";
- while ($query->have_posts()) : $query->the_post();
- $output .= "<li>";
- $output .= "<div class='calendar'>";
- //$output .= "<div class='day'>".localize_day(get_the_date("j"))."</div>";
- $isotime = get_post_meta(get_the_ID(),"tanggal",true)."-".get_post_meta(get_the_ID(),"bulan",true)."-".get_post_meta(get_the_ID(),"tahun",true);
- $bln = array(1=>"Jan","Feb","Mar","Apr","Mei","Jun","Jul","Ags","Sep","Okt","Nov","Des");
- $blnn= get_post_meta(get_the_ID(),"bulan",true);
- $output .= "<div class='day'>".localize_day(strtotime($isotime))."</div>";
- $output .= "<div class='tgl'>".get_post_meta(get_the_ID(),"tanggal",true)."</div>";
- $output .= "<div class='bln'>".$bln[$blnn]."</div>";
- $output .= "</div>";
- $output .= "<div class='meta has-thumb'>";
- $output .= "<h3><a href='".get_permalink()."' title='".esc_html(get_the_title())."'>".esc_html(get_the_title())."</a></h3>";
- $output .= "<div>";
- $output .= "</div>";
- if($style=="style2" && $count==1){
- $output .= "<p>".get_the_excerpt()."</p>";
- }
- $output .= "</div>";
- $output .= "</li>";
- $count++;
- endwhile;
- $output .= "</ul></div></div>";
- break;
- case "style6":
- $output ="<div class='group $style $color '>";
- $output .= "<div class='group-title'>";
- $output .= "<h2><i class='fa fa-folder-open'></i><a href=$category_link>".str_replace("-", " ", $category)."</a></h2>";
- $output .= "<div class='feed'>";
- $output .= "<a href=$category_feed_link data-toggle='tooltip' data-placement='left' title='' data-original-title='Belangganan kategori ini'><i class='fa fa-rss'></i></a>";
- $output .= "</div>";
- $output .= "</div>";
- $output .= "<ul>";
- while ($query->have_posts()) : $query->the_post();
- $output .= "<li>";
- $output .= "<figure class='post-thumbnail'>";
- $postimage = post_image();
- if(!empty($postimage)):
- $output .= "<img src='".resize_image(post_image(),233,150)."' alt='".esc_html(get_the_title())."' width=233 height=150>";
- else:
- $output .= "<img src='".get_template_directory_uri()."/images/placeholder-310.jpg' alt='".esc_html(get_the_title())."' width=233 height=150>";
- endif;
- $output .= "</figure>";
- $output .= "<h3><a href='".get_permalink()."'>".esc_html(get_the_title())."</a></h3>";
- $output .= "<div>";
- $output .= "<span class='time'><i class='fa fa-calendar'></i>".get_the_date('j M Y')."</span>";
- $output .= "<span class='author'><i class='fa fa-user'></i>".get_the_author()."";
- $output .= "</div>";
- $output .= "<p>".get_the_excerpt()."</p>";
- $output .= "</li>";
- endwhile;
- $output .= "</ul>";
- $output .="</div>";
- wp_reset_query();
- return $output;
- break;
- case 'style7':
- $qry[1] = 3;
- $qry[2] = $limit-1;
- $qry['total'] = array_sum($qry);
- $paged = (get_query_var('page')) ? get_query_var('page') : 1;
- $onum = ($qry['total'] * ($paged - 1));
- $type = "post";
- $output = "<div class='style3 group ".$color." ramadhan'>";
- $output .= "<div class='group-title'>";
- $output .= " <h2><i class='fa fa-folder-open'></i><a href=$category_link)>".str_replace("-", " ", $category)."</a></h2>";
- $output .= " <div class='feed' ><a href=$category_feed_link data-toggle='tooltip' data-placement='left' title='Belangganan kategori ini'><i class='fa fa-rss'></i></a></div>";
- $output .= "</div>";
- $output .= "<div class='group-content' style='background:url(".get_template_directory_uri()."/images/rmd.gif)'>";
- $output .= "<div class='row'>";
- $output .= "<div class='col-md-4 group-banner'>";
- $output .= "<img src='".get_template_directory_uri()."/images/rmd-title.png'></div>";
- $offset = ($paged > 1) ? ($onum) : 0;
- query_posts("post_type=$type&category_name=$category&posts_per_page=$qry[total]&paged=$paged&showposts=$qry[1]&offset=$offset");
- $output .= "<div class='col-md-4'>";
- $output .= "<ul class='style2 articles'>";
- if (have_posts()) : while (have_posts()) : the_post();
- $output .= "<li>";
- $output .= "<figure class='thumbnail'>";
- $postimage = post_image();
- if(!empty($postimage)):
- $output .= "<img src='".resize_image(post_image(),70,70)."' alt='".esc_html(get_the_title())."' width=70 height=70>";
- else:
- $output .= "<img src='".get_template_directory_uri()."/images/placeholder-70.jpg' alt='".esc_html(get_the_title())."' width=70 height=70>";
- endif;
- $output .= "</figure>";
- $output .= "<div class='meta'>";
- $output .= "<h3><a href='".get_permalink()."' title='".esc_html(get_the_title())."'>".string_limit_words(esc_html(get_the_title()),8)."</a></h3>";
- $output .= "<div>";
- $output .= "<span class='time'><i class='fa fa-calendar'></i>".get_the_date('j M Y')."</span>";
- $output .= "<span class='author'><i class='fa fa-user'></i>".get_the_author()."";
- $output .= "</div>";
- $output .= "</div>";
- $output .= "</li>";
- endwhile;endif;
- $output .= "</ul></div>";
- $offset = $qry[1] + (($paged > 1) ? $onum : 0);
- query_posts("post_type=$type&category_name=$category&posts_per_page=$qry[total]&offset=$offset&showposts=$qry[2]");
- $output .= "<div class='col-md-4'>";
- $output .= "<ul class='style1 articles'>";
- if (have_posts()) : while (have_posts()) : the_post();
- $output .= "<li>";
- $output .= "<figure class='thumbnail'>";
- $postimage = post_image();
- if(!empty($postimage)):
- $output .= "<img src='".resize_image(post_image(),70,70)."' alt='".esc_html(get_the_title())."' width=70 height=70>";
- else:
- $output .= "<img src='".get_template_directory_uri()."/images/placeholder-70.jpg' alt='".esc_html(get_the_title())."' width=70 height=70>";
- endif;
- $output .= "</figure>";
- $output .= "<div class='meta'>";
- $output .= "<h3><a href='".get_permalink()."' title='".esc_html(get_the_title())."'>".string_limit_words(esc_html(get_the_title()),8)."</a></h3>";
- $output .= "<div>";
- $output .= "<span class='time'><i class='fa fa-calendar'></i>".get_the_date('j M Y')."</span>";
- $output .= "<span class='author'><i class='fa fa-user'></i>".get_the_author()."";
- $output .= "</div>";
- $output .= "</div>";
- $output .= "</li>";
- endwhile;
- endif;
- $output .= "</ul></div></div></div></div>";
- break;
- default:
- break;
- }
- wp_reset_query();
- return $output;
- }
- add_shortcode('post', 'framework_latest_post_sc');
- // Slider
- function framework_slider_sc( $atts, $content = null ) {
- extract( shortcode_atts( array(
- 'category' => '',
- 'tag'=>'',
- 'limit'=> 5,
- ), $atts) );
- $args =array();
- if(!empty($category)){
- $args["category_name"]=$category;
- }else{
- $args["tag"]=$tag;
- }
- $args["posts_per_page"]=$limit;
- $query = new WP_Query($args);
- $output ="<div class='slider-container slidervideo'>";
- $output .= "<div class='flex-slider'>";
- $output .= "<ul class='slides'>";
- while ($query->have_posts()) : $query->the_post();
- // $category = get_the_category();
- $category = explode(",",get_the_category_list(","));
- $output .= "<li data-thumb='".resize_image(post_image(),70,60)."'>";
- $output .= "<img src='".resize_image(post_image(),540,340)."' />";
- $output .= "<div class='caption'>";
- $output .= "<span class=cat><i class='fa fa-folder-open'></i>".$category[0]."</span>";
- $output .= "<span class=cat><i class='fa fa-calendar'></i>".get_the_date("j M Y")."</span>";
- $output .= "<h3><a href=".get_permalink().">".get_the_title()."</a></h3>";
- $output .= "<p>".get_the_excerpt()."</p>";
- $output .= "</div>";
- $output .= "</li>";
- endwhile;
- $output .= "</ul>";
- $output .= "</div>";
- $output .="</div>";
- wp_reset_query();
- // Fallback
- $output .= "<div class='style1 group responsive-group'>";
- $output .= "<div class='group-title'>";
- $output .= " <h2><i class='fa fa-folder-open'></i>Headline</h2>";
- $output .= "</div>";
- $output .= "<div class='group-content'>";
- $output .= "<ul class='style1 articles'>";
- $query = new WP_Query($args);
- while ($query->have_posts()) : $query->the_post();
- $output .= "<li>";
- $output .= "<figure class='thumbnail'>";
- $postimage = post_image();
- if(!empty($postimage)):
- $output .= "<img src='".resize_image(post_image(),70,70)."' alt='".esc_html(get_the_title())."' width=70 height=70>";
- else:
- $output .= "<img src='".get_template_directory_uri()."/images/placeholder-70.jpg' alt='".esc_html(get_the_title())."' width=70 height=70>";
- endif;
- $output .= "</figure>";
- $output .= "<div class='meta has-thumb'>";
- $output .= "<h3><a href='".get_permalink()."' title='".esc_html(get_the_title())."'>".esc_html(get_the_title())."</a></h3>";
- $output .= "<div>";
- $output .= "<span class='time'><i class='fa fa-calendar'></i>".get_the_date('j M Y')."</span>";
- $output .= "<span class='author'><i class='fa fa-user'></i>".get_the_author()."";
- $output .= "</div>";
- if($style=="style2" && $count==1){
- $output .= "<p>".get_the_excerpt()."</p>";
- }
- $output .= "</div>";
- $output .= "</li>";
- endwhile;
- $output .= "</ul></div></div>";
- wp_reset_query();
- return $output;
- }
- add_shortcode('slider', 'framework_slider_sc');
- function framework_slidervideo_sc( $atts, $content = null ) {
- // $args =array();
- // if(!empty($category)){
- // $args["category_name"]=$category;
- // }else{
- // $args["tag"]=$tag;
- // }
- // $args["posts_per_page"]=$limit;
- // $query = new WP_Query($args);
- //$videos = get_latest_youtube("hasmiorg",5);
- $videos = get_latest_youtube("UChBixMZeCCgFvCAjVcakLog",5);
- $output = "<div class='group slidervideo blue'>";
- $output .= "<div class='group-title'>";
- $output .= "<h2><i class='fa fa-folder-open'></i><a href=http://galeri.hasmi.org/>Gallery Hasmi</a></h2>";
- $output .= "<div class='feed' ><a href='http://galeri.hasmi.org/feed' data-toggle='tooltip' data-placement='left' title='Belangganan kategori ini'><i class='fa fa-rss'></i></a></div>";
- $output .= "</div>";
- $output .="<div class='slider-container'>";
- $output .= "<div class='flex-slider'>";
- $output .= "<ul class='slides'>";
- foreach($videos as $video):
- // $category = get_the_category();
- // $category = explode(",",get_the_category_list(","));
- $output .= "<li data-thumb='".resize_image($video["thumbnail"],70,60)."'>";
- $output .= "<a href=".$video["watch"]." class='fancybox-media videoslide'><img src='".resize_image($video["thumbnail"],540,340)."' width=540 height=340/></a>";
- $output .= "<div class='caption'>";
- $output .= "<h3><a href=".$video["watch"]." target='_blank'>".$video["title"]."</a></h3>";
- $output .= "<p>".string_limit_words($video["desc"],20)."</p>";
- $output .= "</div>";
- $output .= "</li>";
- endforeach;
- $output .= "</ul>";
- $output .= "</div>";
- $output .="</div>";
- $output .="</div>";
- // Fallback
- $output .= "<div class='style1 responsive-group group blue'>";
- $output .= "<div class='group-title'>";
- $output .= " <h2><i class='fa fa-folder-open'></i><a href=http://galeri.hasmi.org/>Gallery Hasmi</a></h2>";
- $output .= " <div class='feed' ><a href=$category_feed_link data-toggle='tooltip' data-placement='left' title='Belangganan kategori ini'><i class='fa fa-rss'></i></a></div>";
- $output .= "</div>";
- $output .= "<div class='group-content'>";
- $output .= "<ul class='style1 articles'>";
- foreach($videos as $video):
- $output .= "<li>";
- $output .= "<figure class='thumbnail'>";
- $output .= "<img src='".resize_image($video["thumbnail"],540,340)."' width=540 height=340/>";
- $output .= "</figure>";
- $output .= "<div class='meta has-thumb'>";
- $output .= "<h3><a href='".$video["watch"]."' title='".$video["title"]."'>".$video["title"]."</a></h3>";
- $output .= "</div>";
- $output .= "</li>";
- endforeach;
- $output .= "</ul></div></div>";
- return $output;
- }
- add_shortcode('slidervideo', 'framework_slidervideo_sc');
- // Single Tabbed
- function framework_tabbed_sc( $atts, $content = null ) {
- extract( shortcode_atts( array(
- 'limit'=> 5,
- ), $atts) );
- $output .="<div class='group tabbed-nav'>";
- $output .= "<ul class='tabs'>";
- $output .= "<li><a href='#terbaru' data-toggle='tab'><i class='fa fa-clock-o'></i> Terbaru</a></li>";
- $output .= "<li><a href='#populer' data-toggle='tab'><i class='fa fa-heart'></i> Populer</a></li>";
- $output .= "<li><a href='#pilihan' data-toggle='tab'><i class='fa fa-pencil'></i> Pilihan Editor</a></li>";
- $output .= "</ul>";
- $output .= "<!-- Tab panes -->";
- $output .= "<div class='tab-contents'>";
- $output .= "<div class='tab-pane' id='pilihan'>";
- $output .= "<ul class='articles style1'>";
- $query = new WP_Query(array("tag"=>"pilihan-editor","posts_per_page"=>$limit));
- while($query->have_posts()) : $query->the_post();
- $output .= "<li>";
- $output .= "<figure class='thumbnail'>";
- if(post_image()){
- $output .= "<img src=".resize_image(post_image(),70,60)." alt='thumbnail' width=70 height=60>";
- }else{
- $output .= "<img src='".get_template_directory_uri()."/images/placeholder-70.jpg' alt='thumbnail' width=70 height=60>";
- }
- $output .= "</figure>";
- $output .= "<div class='meta has-thumb'>";
- $output .= "<h3><a href=".get_permalink()." title='".esc_html(get_the_title())."'>".string_limit_words(esc_html(get_the_title()),8)."</a></h3>";
- $output .= "<span class='time'><i class='fa fa-calendar'></i>".get_the_date("j M Y")."</span><span class='author'><i class='fa fa-user'></i>".get_the_author()."</span>";
- $output .= "</div>";
- $output .= "</li>";
- endwhile;
- wp_reset_query();
- $output .= "</ul>";
- $output .= "</div> <!-- pilihan -->";
- $output .= "<div class='tab-pane fade' id='populer'>";
- if (function_exists('wpp_get_mostpopular')) {
- ob_start();
- wpp_get_mostpopular("range=weekly&limit=4&thumbnail_width=70&thumbnail_height=60&post_html=<li><figure>{thumb}</figure><div><h3>{title}</h3></div></li>");
- $output .= $variable = ob_get_clean();
- };
- $output .= "</div> <!-- populer -->";
- $output .= "<div class='tab-pane fade in active' id='terbaru'>";
- $output .= "<ul class='articles style1'>";
- $query = new WP_Query(array("posts_per_page"=>$limit));
- while($query->have_posts()) : $query->the_post();
- $output .= "<li>";
- $output .= "<figure class='thumbnail'>";
- if(post_image()){
- $output .= "<img src=".resize_image(post_image(),70,60)." alt='thumbnail' width=70 height=60>";
- }else{
- $output .= "<img src='".get_template_directory_uri()."/images/placeholder-70.jpg' alt='thumbnail' width=70 height=60>";
- }
- $output .= "</figure>";
- $output .= "<div class='meta has-thumb'>";
- $output .= "<h3><a href=".get_permalink()." title='".esc_html(get_the_title())."'>".string_limit_words(esc_html(get_the_title()),8)."</a></h3>";
- $output .= "<span class='time'><i class='fa fa-calendar'></i>".get_the_date( "j M Y" )."</span><span class='author'><i class='fa fa-user'></i>".get_the_author()."</span>";
- $output .= "</div>";
- $output .= "</li>";
- endwhile;
- $output .= "</ul>";
- $output .= "</div> <!-- terbaru -->";
- $output .= "</div> <!-- tab-pane -->";
- $output .="</div><!-- tabbed group -->";
- wp_reset_query();
- return $output;
- }
- add_shortcode('tabbed', 'framework_tabbed_sc');
- function framework_links_sc($atts,$content=null){
- extract( shortcode_atts( array(
- 'category'=> '',
- 'color'=>'',
- 'title'=>'',
- 'type'=>'list'
- ), $atts) );
- $args = array(
- "category_name"=>$category,
- );
- if($type=="list") $args["link_before"]="<i class='fa fa-link'></i>";
- $output = "<div class='style1 group ".$color." '>";
- $output .= "<div class='group-title'>";
- $output .= " <h2><i class='fa fa-link'></i>".$title."</h2>";
- // if($type!="list"):
- $output .= "<div class='feed'>";
- $output .= "<a id='car_prev' href='#' class='prev' style='display: inline-block;'><i class='fa fa-chevron-left'></i></a>";
- $output .= "<a id='car_next' href='#' class='next' style='display: inline-block;'><i class='fa fa-chevron-right'></i></a>";
- $output .= "</div>";
- // endif;
- $output .= "</div>";
- $output .= "<div class='group-content'>";
- $output .= "<div id='carousel-link'>";
- $tests = get_bookmarks( $args );
- $i = 0;
- foreach( $tests as $link ){
- $open = !($i%9) ? '<div class=car-item><ul>' : ''; //Create open wrapper if count is divisible by 3
- $close = !($i%9) && $i ? '</ul></div>' : ''; //Close the previous wrapper if count is divisible by 3 and greater than 0
- $output .= $close.$open;
- $output .= "<li><a href=".$link->link_url."><i class='fa fa-link'></i> ".$link->link_name."</a></li>";
- $i++;
- }
- $output .= "</div>";
- $output .= "</div></div>";
- return $output;
- }
- add_shortcode('link', 'framework_links_sc');
- /* -------------------------------------------------- */
- /* Content Tabs
- /* -------------------------------------------------- */
- // Tabs container
- function framework_content_tabgroup_sc( $atts, $content = null ) {
- if( !$GLOBALS['tabs_groups'] )
- $GLOBALS['tabs_groups'] = 0;
- $GLOBALS['tabs_groups']++;
- $GLOBALS['tab_count'] = 0;
- $tabs_count = 1;
- do_shortcode( $content );
- if( is_array( $GLOBALS['tabs'] ) ) {
- $i=0;
- foreach( $GLOBALS['tabs'] as $tab ) {
- $active = ($i==0)?"active":"";
- $tabs[] = '<li class='.$active.'><a href="#tab-' . $GLOBALS['tabs_groups'] . '-' . $tabs_count . '" data-toggle="tab">' . $tab['title'] . '</a></li>';
- $panes[] = '<div id="tab-' . $GLOBALS['tabs_groups'] . '-' . $tabs_count++ . '" class="tab-pane '.$active.'">' . do_shortcode( $tab['content'] ) . '</div>';
- $i++;
- }
- $return = "\n". '<ul class="nav nav-tabs">' . implode( "\n", $tabs ) . '</ul>' . "\n" . '<div class="tab-content">' . implode( "\n", $panes ) . '</div>' . "\n";
- }
- return $return;
- }
- add_shortcode('tabgroup', 'framework_content_tabgroup_sc');
- // Single tab
- function framework_content_tab_sc( $atts, $content = null ) {
- extract( shortcode_atts( array(
- 'title' => ''
- ), $atts) );
- $i = $GLOBALS['tab_count'];
- $GLOBALS['tabs'][$i] = array( 'title' => sprintf( $title, $GLOBALS['tab_count'] ), 'content' => $content );
- $GLOBALS['tab_count']++;
- }
- add_shortcode('tab', 'framework_content_tab_sc');
- function framework_social_box_sc( $atts, $content = null ){
- $output = "<div class='group social-stats'>";
- $output .= "<div class='group-content'>";
- $output .= "<h2>'Sampaikanlah <br>walau <br>satu ayat'</h2>";
- $output .= "<ul>";
- $output .= "<li><span class='count'><i class='fa fa-facebook-square'></i></span>Like Page Hasmi dan dapatkan informasi terbaru";
- $output .= "<div>";
- $output .= "<a href='".get_option("hasmi_facebook")."' class='btn btn-md btn-primary'>Like</a>";
- $output .= "</div>";
- $output .= "</li>";
- $output .= "<li><span class='count'><i class='fa fa-twitter'></i></span>Follow kami di twitter untuk mendapatkan update terbaru";
- $output .= "<div>";
- $output .= "<a href='".get_option("hasmi_twitter")."' class='btn btn-md btn-success'>Follow</a>";
- $output .= "</div>";
- $output .= "</li>";
- $output .= "<li><span class='count'><i class='fa fa-rss'></i></span>Dapatkan artikel terbaru Hasmi di email anda";
- $output .= "<div>";
- $output .= "<a href='".home_url()."/feed' class='btn btn-md btn-warning'>Subscribe</a>";
- $output .= "</div>";
- $output .= "</li>";
- $output .= "</ul>";
- $output .= "</div>";
- $output .= "</div>";
- return $output;
- }
- add_shortcode('socialbox', 'framework_social_box_sc');
- /* -------------------------------------------------- */
- /* Editor Fix (Raw)
- /* -------------------------------------------------- */
- function my_formatter( $content ) {
- $new_content = '';
- $pattern_full = '{(\[raw\].*?\[/raw\])}is';
- $pattern_contents = '{\[raw\](.*?)\[/raw\]}is';
- $pieces = preg_split( $pattern_full, $content, -1, PREG_SPLIT_DELIM_CAPTURE );
- foreach ( $pieces as $piece ) {
- if ( preg_match( $pattern_contents, $piece, $matches ) ) {
- $new_content .= $matches[1];
- } else {
- $new_content .= wptexturize( wpautop( $piece ) );
- }
- }
- return $new_content;
- }
- remove_filter('the_content', 'wpautop');
- remove_filter('the_content', 'wptexturize');
- add_filter('the_content', 'my_formatter', 99);
- /* ---------------------------------------------------------------------- */
- /* TinyMCE Buttons
- /* ---------------------------------------------------------------------- */
- function add_shortcodes_button() {
- if ( !current_user_can('edit_posts') && !current_user_can('edit_pages') )
- return;
- if ( get_user_option('rich_editing') == 'true' ) {
- add_filter('mce_external_plugins', 'add_shortcodes_tinymce_plugin');
- add_filter('mce_buttons', 'register_shortcodes_button');
- }
- }
- add_action('init', 'add_shortcodes_button');
- function register_shortcodes_button( $buttons ) {
- array_push( $buttons, '|', 'framework_shortcodes' );
- return $buttons;
- }
- function add_shortcodes_tinymce_plugin( $plugin_array ) {
- $plugin_array['framework_shortcodes'] = get_template_directory_uri() . '/include/tinymce/tinymce.js';
- return $plugin_array;
- }
- function my_refresh_mce( $ver ) {
- $ver += 3;
- return $ver;
- }
- add_filter('tiny_mce_version', 'my_refresh_mce');
- /* ---------------------------------------------------------------------- */
- /* Quicktags
- /* ---------------------------------------------------------------------- */
- function aw_quicktags() {
- wp_enqueue_script( 'aw_quicktags', get_template_directory_uri() . '/include/tinymce/quicktags.js', array('quicktags') );
- }
- add_action('admin_print_scripts', 'aw_quicktags');
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement