Direct script access denied.' );
}
function articled_conditional_enqueues() {
if(!is_single()):
if( get_theme_mod('articled_blog_post_layout') == '3' || get_theme_mod('articled_blog_post_layout') == '4') {
wp_enqueue_style('blog-post-classic', get_template_directory_uri() . '/assets/css/blog-post-classic.css', '', '1.0', 'all');
}
if( get_theme_mod('articled_blog_post_layout') == '5' || get_theme_mod('articled_blog_post_layout') == '6') {
wp_enqueue_style('blog-post-masonry', get_template_directory_uri() . '/assets/css/blog-post-masonry.css', '', '1.0', 'all');
}
if( get_theme_mod('articled_blog_post_layout', '2') == '1' || get_theme_mod('articled_blog_post_layout', '2') == '2') {
wp_enqueue_style('blog-post-list', get_template_directory_uri() . '/assets/css/blog-post-list.css', '', '1.0', 'all');
}
endif;
}
add_action('wp_enqueue_scripts', 'articled_conditional_enqueues');
if (get_theme_mod('articled_footer_widget_cols', '4') == '4' || get_theme_mod('articled_footer_widget_cols', '4') == '3' ) {
function articled_widgets_third(){
register_sidebar(array(
'name' => __('Footer Widgets 3', 'articled'),
'id' => 'articled-footer-3',
'description' => '',
'before_widget' => '
',
'after_widget' => "
",
'before_title' => '',
));
}
add_action( 'widgets_init', 'articled_widgets_third' );
}
if (get_theme_mod('articled_footer_widget_cols', '4') == '4') {
function articled_widgets_fourth(){
register_sidebar(array(
'name' => __('Footer Widgets 4', 'articled'),
'id' => 'articled-footer-4',
'description' => '',
'before_widget' => '',
'after_widget' => "
",
'before_title' => '',
));
}
add_action( 'widgets_init', 'articled_widgets_fourth' );
}
if (get_theme_mod('articled_single_cussideb', false) === true) {
function articled_post_single(){
register_sidebar(array(
'name' => __('Singel Post Sidebar', 'articled'),
'id' => 'articled-post-single',
'description' => '',
'before_widget' => '',
'after_widget' => "
",
'before_title' => '',
));
}
add_action( 'widgets_init', 'articled_post_single' );
}
/// Don't Touch it.
$get_blog_layout = get_theme_mod('articled_blog_post_layout', '2');
$e_blog_layout = '';
switch($get_blog_layout) {
case 1 :
case 2 :
$e_blog_layout = 'list';
break;
case 3 :
case 4 :
$e_blog_layout = 'classic';
break;
case 5 :
case 6 :
$e_blog_layout = 'masonry';
break;
default:
$e_blog_layout = 'list';
}
if (!function_exists('clickable_date')) {
function clickable_date() {
echo '';
echo ' ' . get_the_date('M') . '';
echo ' ' . get_the_date('j') . ',';
echo ' ' . get_the_date('Y') . '';
}
}
if( !function_exists('_html_decode') ) {
function _html_decode($string) {
return htmlspecialchars_decode( stripslashes_deep($string) );
}
}
if( !function_exists('_html_encode') ) {
function _html_encode($string) {
return htmlspecialchars( $string );
}
}
if ( !function_exists('articled_meta')):
function articled_meta( $metaID ) {
global $post;
$get_value = get_post_meta($post->ID, $metaID, true);
if ( $get_value == 'default' || $get_value == 'show' || $get_value == '') {
$get_value = true;
} elseif( $get_value == 'hide' ) {
$get_value = false;
} else{
$get_value = $get_value;
}
return $get_value;
}
endif;
if ( !function_exists('articled_user_meta')):
function articled_user_meta( $metaID ) {
global $post;
$get_value = get_user_meta($post->ID, $metaID, true);
if ( $get_value == 'default' || $get_value == 'show' || $get_value == '') {
$get_value = 'true';
} elseif( $get_value == 'hide' ) {
$get_value = 'false';
} else{
$get_value = $get_value;
}
return $get_value;
}
endif;
if( !function_exists('articled_comb_options') ) :
function articled_comb_options($articled_theme_option = null, $articled_post_option = null, $echoing = null){
global $post;
$articled_theme_options = get_theme_mod( $articled_theme_option, true );
//if ( is_single() ) {
$articled_post_options = get_post_meta( $post->ID, $articled_post_option, true );
//} else {
// $articled_post_options = true;
//}
if ( $articled_post_options == 'show') {
$articled_post_options = true;
} elseif ( $articled_post_options == '' || $articled_post_options == 'default' ) {
$articled_post_options = $articled_theme_options;
} else {
$articled_post_options = false;
}
if ( ( $articled_theme_options == false || $articled_theme_options == 0 ) && $articled_post_options == true ) {
// $output = 'flase true';
$output = true;
} elseif ( ( $articled_theme_options == true || $articled_theme_options == 1) && $articled_post_options == false ) {
// $output = 'true false';
$output = false;
} elseif ( ( $articled_theme_options == false || $articled_theme_options == 0 ) && $articled_post_options == false ) {
// $output = 'false false';
$output = false;
} else {
$output = true;
}
// return output final boolen
if ($echoing) {
echo ''.$output;
} else {
$output = $output;
}
return $output;
}
endif;
if( !function_exists('articled_single_sidebar') ) :
function articled_single_sidebar($is_onside = false) {
global $post;
$articled_theme_options = get_theme_mod( 'articled_single_post_sibebar', 'show-right' );
$articled_post_options = get_post_meta( $post->ID, 'articled_sidebar_meta_options', true );
if( $articled_theme_options == 'show-right' || $articled_theme_options == '') {
if(!$is_onside){
$content = 'col-md-9';
} else {
$content = 'col-md-3';
}
} elseif($articled_theme_options == 'show-left' && ($articled_post_options == 'show_left'
|| $articled_post_options == '' || $articled_post_options == 'default' ) ) {
if(!$is_onside){
$content = 'col-md-9';
} else {
$content = 'col-md-3 left-mod';
}
if( !function_exists('articled_single_post_sibebar_on_left') ){
function articled_single_post_sibebar_on_left(){
echo '';
}
add_action('wp_footer', 'articled_single_post_sibebar_on_left');
}
} else {
if(!$is_onside){
$content = 'col-md-10';
} else {
$content = false;
}
}
if( $articled_post_options == 'default' || $articled_post_options == '') {
$final_output = $content;
} elseif ( $articled_post_options == 'hide' ) {
if(!$is_onside){
$final_output = 'col-md-12';
} else {
$final_output = false;
}
} elseif ( $articled_post_options == 'show_right' ) {
if(!$is_onside){
$final_output = 'col-md-9';
} else {
$final_output = 'col-md-3';
}
} elseif ( $articled_post_options == 'show_left' ) {
if(!$is_onside){
$final_output = 'col-md-9';
} else {
$final_output = 'col-md-3 left-meta';
}
add_action('wp_footer', function(){
echo '';
});
} else {
if(!$is_onside){
$final_output = 'col-md-9';
} else {
$final_output = 'col-md-3';
}
}
return $final_output;
}
endif;
if ( !function_exists('articled_options')):
function articled_options($id) {
$articled_option = get_option('articled_options');
$output = _html_decode($articled_option[$id]);
return $output;
}
endif;
if ( !function_exists('articled_mod')):
function articled_mod($name, $default = false, $echo = false) {
$output = get_theme_mod( $name, $default );
if($echo) {
echo $output;
} else {
return $output;
}
}
endif;
if(!function_exists('social_icon_loops')){
function social_icon_loops() {
$nadas = array(
'facebook' => array(
'url' => get_theme_mod( 'articled_facebook_url', '#'),
'class' => ' fa-facebook scrb-facebook ',
),
'twitter' => array(
'url' => get_theme_mod( 'articled_twitter_url'),
'class' => ' fa-twitter-square scrb-twitter ',
),
'youtube' => array(
'url' => get_theme_mod( 'articled_youtube_url'),
'class' => ' fa-youtube scrb-youtube ',
),
'instagram' => array(
'url' => get_theme_mod( 'articled_instagram_url'),
'class' => ' fa-instagram scrb-instagram ',
),
'pinterest' => array(
'url' => get_theme_mod( 'articled_pinterest_url'),
'class' => ' fa-pinterest scrb-pinterest ',
),
'google' => array(
'url' => get_theme_mod( 'articled_google_plus_url'),
'class' => ' fa-google-plus scrb-google ',
),
);
foreach($nadas as $key ){
if(!empty($key['url'])){
echo ''
. '' . '';
}
}
}
}
if( !function_exists('articled_post_type')):
function articled_post_type($post_id) {
return get_post_format( $post_id );
}
endif;
if( !function_exists('articled_video_attachments') ) :
function articled_video_attachments($videoID, $echo){
$video_url = wp_get_attachment_url($videoID);
$video_e = '';
if($echo) {
echo $video_e;
} else {
return $video_e;
}
}
endif;
// Thumbnail Images function_exists
if( !function_exists('articled_classic_thumbnail') ) :
function articled_classic_thumbnail( $data_src = 'thumbnail', $scr = 'thumbnail', $default = null) {
if( has_image_size( $scr )){
$img_src = get_the_post_thumbnail_url( get_the_ID(), $scr );
} else {
$img_src = get_the_post_thumbnail_url( get_the_ID(), 'medium' );
}
$img_data_data = get_the_post_thumbnail_url( get_the_ID(), $data_src );
$data_src_small = get_the_post_thumbnail_url( get_the_ID(), 'articled_data_src_small' );
$data_src_medium = get_the_post_thumbnail_url( get_the_ID(), 'articled_data_src_medium' );
$data_src_large = get_the_post_thumbnail_url( get_the_ID(), 'articled_data_src_large' );
if ( !$default = null ) {
$thumbnail = $default;
}
$img_title = get_the_title(get_post_thumbnail_id());
$img_alt = get_post_meta(get_post_thumbnail_id(), '_wp_attachment_image_alt', true);
if(!empty($img_alt)){
$img_alt = $img_alt;
} else {
$img_alt = $img_title;
}
if ( has_post_thumbnail() && strlen(get_the_post_thumbnail()) ) {
// If Post has Thumbnail
$thumbnail = '
'
.''
.'';
} else {
// If, It is not page
if(!is_page()){
// If Post doesn't has Thumbnail, then SHow default Images
$thumbnail = '
';
}
}
// return final thumnail to echo out
return $thumbnail;
}
endif;
// Thumbnail Images function_exists
if( !function_exists('articled_gallery_images') ) :
function articled_gallery_images( $data_src = 'thumbnail', $scr = 'thumbnail', $default) {
$img_src = wp_get_attachment_url( $default, $scr );
$img_data_data = wp_get_attachment_url( $default, $data_src);
$data_src_small = wp_get_attachment_url( $default, 'articled_data_src_small' );
$data_src_medium = wp_get_attachment_url( $default, 'articled_data_src_medium' );
$data_src_large = wp_get_attachment_url( $default, 'articled_data_src_large' );
$img_title = get_the_title($default);
$img_alt = get_post_meta($default, '_wp_attachment_image_alt', true);
if(!empty($img_alt)){
$img_alt = $img_alt;
} else {
$img_alt = $img_title;
}
$thumbnail = '
'
.''
.'';
return $thumbnail;
}
endif;
if( !function_exists('articled_edit_delete_post') ) :
function articled_edit_delete_post(){
if( is_user_logged_in() && current_user_can( 'edit_posts' ) ) {
echo '[';
edit_post_link( __( 'Edit', 'articled' ), '', '', null, 'edit-post-link' );
echo ''.__( 'Delete', 'articled' ).']' ;
};
}
endif;
if( !function_exists('articled_comments_count') ) :
function articled_comments_count($comments_number = null){
if( $comments_number == null) {
global $post;
$comments_number = get_comments_number( $post->ID);
} elseif (articled_options('articled_fb_comments_enabled') == 'on') {
$response = wp_remote_get( 'https://graph.facebook.com/'.get_the_permalink() );
if ( is_array( $response ) && ! is_wp_error( $response ) ) {
$headers = $response['headers']; // array of http header lines
$body = $response['body']; // use the content
}
$body = json_decode($body, true);
if(is_array($body)){
$comments_number = $body['share']['comment_count'];
}
} else {
$comments_number = $comments_number;
}
if($comments_number > 1) {
printf( _x('%1$s comments','plural comments','articled'), number_format_i18n( $comments_number ) );
} elseif ( $comments_number ) {
echo _x( 'One Comment', 'singular comment', 'articled' );
} else {
_e('No Comments', 'articled' );
}
}
endif;