$ads = ' '; $adsm = ' '; // $ads = $adsm = ''; /* SEO Start */ // Get Category $cat = get_the_category(); $thecat = $cat[0]->name; $catid = $cat[0]->cat_ID; // Get Tags $tags = get_the_tags(); $kwd3 = ''; $tag_links = ''; // $kwd5 = ''; if ( ! empty( $tags ) ) { shuffle($tags); $tg = 1; foreach ( $tags as $t4g ) { if ( $tg <= 3 ) { $kwd3 .= ucwords($t4g->name.', '); $tag_links .= '' . $t4g->name . ', '; } elseif ( $tg <= 4 ) { $tag_links .= '' . $t4g->name . ', '; } if ( $tg == 4 ) { break; } ++$tg; } $kwd3 = substr($kwd3, 0, -2); $tag_links = substr($tag_links, 0, -2); } $kwd3 = substr($kwd3, 0, -2); // $kwd5 = substr($kwd5, 0, -2); /* GET ATTACHMENTS */ $args = array( 'order' => 'ASC', 'post_type' => 'attachment', 'post_parent' => $post->ID, 'post_mime_type' => 'image', 'post_status' => null, 'numberposts' => -1, ); $atts = get_children($args); // Prepare SEO $canonuri = $siteurl.'/'.$post->post_name.'/'; $mtt = $thecat . ': ' . $post->post_title . ' - ' . $kwd3 . ' - ' . $sitename; // $mtt = $post->post_title . ' - ' . $sitedesc; $p1 = $p2 = ''; if ( ! empty( $post->post_content ) ) { $pct = $post->post_content; $pct = apply_filters('the_content', $pct); $pct = str_replace(']]>', ']]>', $pct); $pct = rem_str('

', '

', $pct); $pct = rem_str('

', '

', $pct); $pct = rem_str('

', '

', $pct); $pct = str_replace(array("\n","\r","\t"), '', $pct); //minifikasi $pct = str_replace('

','

(.Y.)

', $pct); $xc = explode('(.Y.)',$pct); $total = count($xc); $last_index = $total - 1; $rindex = mt_rand(1, $last_index); $p1 = ' ' . strip_tags( $xc[0] ); $p2 = ' ' . strip_tags( $xc[$rindex] ); } $mtd = $thecat . ': ' . $post->post_title . ' - ' . $kwd3 . '.' . $p1; $mtk = $thecat . ': ' . $post->post_title . ' - ' . $kwd3 . '.' . $p2; /* SEO End */ /* LOAD HEADER */ include(TEMPLATEPATH .'/header.php'); require_once 'Mobile_Detect.php'; $detect = new Mobile_Detect; ob_start(); echo '

'; if ( have_posts() ) : while ( have_posts() ) : the_post(); /* BREADCRUMBS */ echo '
'. ' » ' . ' » ' . 'Currently viewing..
'; echo '

' . $post->post_title . '

'; echo ''; /*echo 'IKLAN';*/ // echo "\n"; /*if ( is_user_logged_in() ) { foreach ( $atts as $at ) { $im = wp_get_attachment_image_src( $at->ID, 'full' ); //echo ''; echo get_the_title($at->ID) . '
'; } }*/ /* PROCESS ATTACHMENTS */ $i = $ti = 0; $ims = ''; shuffle($atts); foreach ( $atts as $at ) { if ( $i > 5 ) { break; } elseif ( $i > 0 ) { // $atitle = str_replace( array('-', '_', '+'), ' ', $atitle ); $atitle = ucwords( $at->post_title ); $alt = $thecat . ': ' . $atitle . ' - ' . $post->post_title; $im = wp_get_attachment_image_src( $at->ID, 'full' ); $aturl = get_attachment_link( $at->ID ); $nsc = ''; if ( $ccode != 'ID' ) { $altn = $thecat . ': ' . $atitle . ' - ' . ucwords( $tags[ $ti ]->name ); $imn = wp_get_attachment_image_src( $at->ID, 'large' ); $nsc = ''; } $ims .= '

' . $alt . '' . $nsc . '

'; $ims .= '

' . ucfirst(strtolower($atitle)) . '.

'; if ( $i == 2 ) { if ( ! empty( $ads ) && ! empty( $adsm ) ) { if ( $detect->isMobile() && !$detect->isTablet() ) { $ims .= '
' . $adsm . '
'; } else { $ims .= '
' . $ads . '
'; } } } } else { // $atitle = str_replace( array('-', '_', '+'), ' ', $atitle ); $atitle = ucwords( $at->post_title ); $alt = $thecat . ': ' . $atitle . ' - ' . $post->post_title; $im = wp_get_attachment_image_src( $at->ID, 'full' ); $aturl = get_attachment_link( $at->ID ); $nsc = ''; if ( $ccode != 'ID' ) { $altn = $thecat . ': ' . $atitle . ' - ' . ucwords($tags[ $ti ]->name); $imn = wp_get_attachment_image_src( $at->ID, 'large' ); $nsc = ''; } echo '

' . $alt . '' . $nsc . '

'; } ++$i; if ( $ti + 1 == $tc ) { $ti = 0; } else { ++$ti; } } /* CONTENT */ $con = $post->post_content; $con = apply_filters( 'the_content', $con ); $con = str_replace( array("\n", "\r", "\t"), '', $con ); //minifikasi echo '
'; if ( ! empty( $ads ) && ! empty( $adsm ) ) { if ( $detect->isMobile() && !$detect->isTablet() ) { echo '
' . $adsm . '
'; } else { echo '
' . $ads . '
'; } } echo $con . '
'; /*echo '
IKLAN
' . $con . '
'; echo 'IKLAN';*/ if ( ! empty( $con ) ) { if ( ! empty( $ads ) && ! empty( $adsm ) ) { if ( $detect->isMobile() && !$detect->isTablet() ) { echo '
' . $adsm . '
'; } else { echo '
' . $ads . '
'; } } } echo $ims . '
'; if ( empty( $con ) ) { if ( ! empty( $ads ) && ! empty( $adsm ) ) { if ( $detect->isMobile() && !$detect->isTablet() ) { echo '
' . $adsm . '
'; } else { echo '
' . $ads . '
'; } } } /* THUMBNAILS */ if ( $atts ) { echo '

Gallery of '.$post->post_title.'

'; echo '
'; // echo $thumbnails; shuffle($atts); $tc = count($tags); $i = 0; foreach ( $atts as $tmb ) { // $tmbtitle = str_replace( array('-', '_', '+'), ' ', $tmbtitle ); $tmbtitle = ucwords($tmb->post_title); $tmbalt = $thecat . ': ' . $tmbtitle . ' - ' . $post->post_title; // $tmbalt = $atitle . ': ' . $post->post_title. ', ' . $thecat; $tmbs = wp_get_attachment_image_src( $tmb->ID, 'thumbnail' ); $aturi = get_attachment_link( $tmb->ID ); $nsc = ''; if ( $ccode != 'ID' ) { $tmbaltn = $thecat . ': ' . $tmbtitle . ' - ' . ucwords( $tags[ $i ]->name ); $tmbn = wp_get_attachment_image_src( $tmb->ID, 'full' ); $nsc = ''; } echo ''; if ( $i + 1 == $tc ) { $i = 0; } else { ++$i; } } echo '
'; } /*TAGS*/ if ( $tag_links ) { echo '
Tags: '. $tag_links . '.
'; } endwhile; endif; echo '
'; // Related Posts echo '

Related Posts of ' . $post->post_title . '

'; $categories = get_the_category( $post->ID ); $first_cat = $categories[0]->cat_ID; $args = array( 'category__in' => array( $first_cat ), 'post__not_in' => array( $post->ID ), 'posts_per_page' => 4, 'orderby' => 'rand', 'ignore_sticky_posts' => 1, 'cache_results' => false, 'no_found_rows' => false ); $swp_query = new WP_Query( $args ); if ( $swp_query->have_posts() ) : while ( $swp_query->have_posts() ) : $swp_query->the_post(); echo '
'; $args = array( 'order' => 'ASC', 'post_type' => 'attachment', 'post_parent' => $post->ID, 'post_mime_type' => 'image', 'post_status' => null, 'numberposts' => 1, 'cache_results' => false, 'no_found_rows' => false ); $atts = get_children($args); if ( ! empty( $atts ) ) { foreach ( $atts as $at ) { $im = wp_get_attachment_image_src( $at->ID, 'thumbnail' ); echo '
' . get_the_title() . '
'; } } echo '

' . get_the_title() . '

'; $exc = get_the_excerpt(); echo strlen($exc) > 200 ? substr($exc, 0, 200) . '...' : $exc; // echo '

View More

'; echo '
'; // .rpbox endwhile; wp_reset_postdata(); endif; echo '
'; // .pw // Popular Posts echo '

Most Popular

'; $categories = get_the_category( $post->ID ); $first_cat = $categories[0]->cat_ID; $args = array( 'orderby' => 'meta_value_num', 'meta_key' => '_views', 'posts_per_page' => 4, 'ignore_sticky_posts' => 1, 'cache_results' => false, 'no_found_rows' => false ); $swp_query = new WP_Query( $args ); if ( $swp_query->have_posts() ) : while ( $swp_query->have_posts() ) : $swp_query->the_post(); echo '
'; $args = array( 'order' => 'ASC', 'post_type' => 'attachment', 'post_parent' => $post->ID, 'post_mime_type' => 'image', 'post_status' => null, 'numberposts' => 1, 'cache_results' => false, 'no_found_rows' => false ); $atts = get_children($args); if ( ! empty( $atts ) ) { foreach ( $atts as $at ) { $im = wp_get_attachment_image_src( $at->ID, 'thumbnail' ); echo '
' . get_the_title() . '
'; } } echo '
' . get_the_title() . '
'; $exc = get_the_excerpt(); echo strlen($exc) > 200 ? substr($exc, 0, 200) . '...' : $exc; // echo '

View More

'; echo '
'; // .rpbox endwhile; wp_reset_postdata(); endif; echo '
'; // .pw // Random Posts echo '

Interesting Ideas..

'; $args = array( 'post__not_in' => array( $post->ID ), 'posts_per_page' => 4, 'orderby' => 'rand', 'ignore_sticky_posts' => 1, 'cache_results' => false, 'no_found_rows' => false ); $swp_query = new WP_Query( $args ); // $counter = 1; // $hx = 'h5'; if ( $swp_query->have_posts() ) : while ( $swp_query->have_posts() ) : $swp_query->the_post(); echo '
'; $args = array( 'order' => 'ASC', 'post_type' => 'attachment', 'post_parent' => $post->ID, 'post_mime_type' => 'image', 'post_status' => null, 'numberposts' => 1, 'cache_results' => false, 'no_found_rows' => false ); $atts = get_children($args); if ( ! empty( $atts ) ) { foreach ( $atts as $at ) { $im = wp_get_attachment_image_src( $at->ID, 'thumbnail' ); echo '
' . get_the_title() . '
'; } } // $hx = $counter > 2 ? 'h6' : $hx; echo '
' . get_the_title() . '
'; $exc = get_the_excerpt(); echo strlen($exc) > 200 ? substr($exc, 0, 200) . '...' : $exc; // echo '

View More

'; echo '
'; // .rpbox // ++$counter; endwhile; wp_reset_postdata(); endif; echo '
'; // .pw /*echo '

Most Popular

'; $args = array( 'posts_per_page' => 4, 'orderby' => 'meta_value_num', 'meta_key' => '_views', 'ignore_sticky_posts' => 1 ); $swp_query = new WP_Query( $args ); $counter = 1; if ( $swp_query->have_posts() ) : while ( $swp_query->have_posts() ) : $swp_query->the_post(); echo $counter == 1 ? '
' : ''; echo $counter == 3 ? '
' : ''; $args = array( 'order' => 'ASC', 'post_type' => 'attachment', 'post_parent' => $post->ID, 'post_mime_type' => 'image', 'post_status' => null, 'numberposts' => 1, ); echo '
'; $atts = get_children($args); if ( ! empty( $atts ) ) { foreach ( $atts as $at ) { $im = wp_get_attachment_image_src( $at->ID, 'thumbnail' ); echo '
' . get_the_title() . '
'; } } echo '

' . get_the_title() . '

'; $exc = get_the_excerpt(); echo strlen($exc) > 80 ? substr($exc, 0, 80) . '...' : $exc; echo '
'; echo $counter == 2 ? '
' : ''; echo $counter == 4 ? '
' : ''; $counter++; endwhile; wp_reset_postdata(); endif; echo '
'; // .pw*/ /*echo '

Interesting Stuff

'; $args = array( 'post__not_in' => array( $post->ID ), 'posts_per_page' => 8, 'orderby' => 'rand', 'ignore_sticky_posts' => 1 ); $swp_query = new WP_Query( $args ); $counter = 1; if ( $swp_query->have_posts() ) : while ( $swp_query->have_posts() ) : $swp_query->the_post(); echo $counter == 1 ? '
' : ''; echo $counter == 5 ? '
' : ''; $args = array( 'order' => 'ASC', 'post_type' => 'attachment', 'post_parent' => $post->ID, 'post_mime_type' => 'image', 'post_status' => null, 'numberposts' => 1, ); echo '
'; $atts = get_children($args); if ( ! empty( $atts ) ) { foreach ( $atts as $at ) { $im = wp_get_attachment_image_src( $at->ID, 'thumbnail' ); echo '
' . get_the_title() . '
'; } } echo '

' . get_the_title() . '

'; $exc = get_the_excerpt(); echo strlen($exc) > 80 ? substr($exc, 0, 80) . '...' : $exc; echo '
'; echo $counter == 4 ? '
' : ''; echo $counter == 8 ? '
' : ''; $counter++; endwhile; wp_reset_postdata(); endif; echo '
';*/ echo '
'; ob_end_flush(); /* LOAD SIDEBAR */ include(TEMPLATEPATH .'/sidebar.php'); /* LOAD FOOTER */ include(TEMPLATEPATH .'/footer.php');