<?php 
/**
 * Tema WP prestasi, tema CMS Wordpress untuk website Dealer
 * Author : Ciuss Creative
 * Facebook : http://facebook.com/ciussgw
 * Whatsapp : 0815-3274-4804
 */
 
// tambah shortcode untuk tex di Customizer
add_filter( 'widget_text', 'do_shortcode' );
// tambahkan do_shortcode pada customizer , example do_shortcode(get_theme_mod());

add_shortcode('break', 'prestasi_br_shortcode'); 
function prestasi_br_shortcode() { 
    $message = '<br/>'; 
	return $message;
} 
add_shortcode('agen', 'profile_sekolah_shortcode'); 
function profile_sekolah_shortcode() { 
    if ( get_theme_mod('nama_sekolah') != "" ) {
		$profile_sekolah = get_theme_mod('nama_sekolah'); 
	} else {
	    $profile_sekolah = 'Sekolahku Keren'; 
	}
    $message = '<strong>'. $profile_sekolah .'</strong>'; 
	return $message;
} 
add_shortcode('judul', 'prestasi_title_shortcode'); 
function prestasi_title_shortcode() { 
    $message = '<strong>'. get_the_title() .'</strong>'; 
	return $message;
} 
add_shortcode('tautan', 'prestasi_link_shortcode'); 
function prestasi_link_shortcode() { 
    $message = ""; 
    $message .= '<span>'; 
    $message .= get_the_permalink(); 
	$message .= '</span>'; 
	return $message;
} 
add_shortcode('tipe', 'prestasi_tipe_shortcode'); 
function prestasi_tipe_shortcode() { 
    global $post;
	$rep_fields = get_post_meta($post->ID, 'rep_fields', true);
	if (is_array($rep_fields)) {
		$count = 0;
		foreach ( $rep_fields as $tipe ) {
		    $count++;
			if ($count == 1) {			
		    $message = $tipe['typem'];
			}
		}
	}
	return $message;
} 
add_shortcode('harga', 'prestasi_price_shortcode'); 
function prestasi_price_shortcode() { 
    global $post;
	$rep_fields = get_post_meta($post->ID, 'rep_fields', true);
	if (is_array($rep_fields)) {
		$count = 0;
		foreach ( $rep_fields as $field ) {
		    $count++;
			if ($count == 1) {			
		    $message = '<strong>'. $field['pricem'] .'</strong>';
			}
		}
	}
	return $message;
}

?>