publish;
return $get_posts_count >= 1;
}
// check if blog pages equal 1 or more than 1
function more__than__1__page(){
$count_pages = wp_count_posts('page');
$get_pages_count = $count_pages->publish;
return $get_pages_count >= 1;
}
// get latest posts
function get__latest__posts($posts_number = '10'){
$latest_post_args = array( 'numberposts' => $posts_number, 'post_type' => 'post', 'post_status' => 'publish' );
$recent_posts = wp_get_recent_posts( $latest_post_args );
$html = '';
foreach( $recent_posts as $recent ){
$html .= '
'.$recent["post_title"].'';
}
return $html;
}
// get tags list
function get__tags__list($tags_number = '10'){
$tags = get_tags("orderby=count&hide_empty=1&number=$tags_number");
$html = '';
foreach ( $tags as $tag ) {
$tag_link = get_tag_link( $tag->term_id );
$html .= "{$tag->name}";
}
return $html;
}
/* Shortcodes */
// daily archive shortcode
function daily__archive( $atts, $content = null ){
extract(
shortcode_atts(
array(
"number" => '', // default is no limit.
"heading" => 'h3', // default is .
"list" => 'ul', // default is unordered list .
"title" => 'Daily Archive', // default title is Daily Archive.
),$atts
)
);
?>
$title$heading>";
$result .= "<$list>";
$result .= wp_get_archives( array( 'type' => 'daily', 'limit' => $number, 'echo' => 0 ) );
$result .= "$list>";
return $result;
?>
'', // default is no limit.
"heading" => 'h3', // default is .
"list" => 'ul', // default is unordered list .
"title" => 'Monthly Archive', // default title is Monthly Archive.
),$atts
)
);
?>
$title$heading>";
$result .= "<$list>";
$result .= wp_get_archives( array( 'type' => 'monthly', 'limit' => $number, 'echo' => 0 ) );
$result .= "$list>";
return $result;
?>
'', // default is no limit.
"heading" => 'h3', // default is .
"list" => 'ul', // default is unordered list .
"title" => 'Yearly Archive', // default title is Yearly Archive.
),$atts
)
);
?>
$title$heading>";
$result .= "<$list>";
$result .= wp_get_archives( array( 'type' => 'yearly', 'limit' => $number, 'echo' => 0 ) );
$result .= "$list>";
return $result;
?>
'10', // default is 10 posts.
"heading" => 'h3', // default is .
"list" => 'ul', // default is unordered list .
"title" => 'Latest Posts', // default title is Latest Posts.
),$atts
)
);
?>
$title$heading>";
$result .= "<$list>";
$result .= get__latest__posts($number);
$result .= "$list>";
return $result;
?>
'', // default is no limit.
"heading" => 'h3', // default is .
"list" => 'ul', // default is unordered list .
"title" => 'Categories', // default title is Categories.
),$atts
)
);
?>
$title$heading>";
$result .= "<$list>";
$result .= wp_list_categories("title_li=0&number=$number&echo=0");
$result .= "$list>";
return $result;
?>
'10', // default is 10 tags.
"heading" => 'h3', // default is .
"list" => 'ul', // default is unordered list .
"title" => 'Tags', // default title is Tags.
),$atts
)
);
?>
= 1 ) : ?>
$title$heading>";
$result .= "<$list>";
$result .= get__tags__list($number);
$result .= "$list>";
return $result;
?>
'', // default is no limit.
"heading" => 'h3', // default is .
"list" => 'ul', // default is unordered list .
"title" => 'My Pages', // default title is My Pages.
),$atts
)
);
?>
$title$heading>";
$result .= "<$list>";
$result .= wp_list_pages("title_li=0&number=$number&echo=0");
$result .= "$list>";
return $result;
?>
'', // default is no limit.
"heading" => 'h3', // default is .
"list" => 'ul', // default is unordered list .
"title" => 'Authors', // default title is Authors.
),$atts
)
);
?>
$title$heading>";
$result .= "<$list>";
$result .= wp_list_authors("hide_empty=1&show_fullname=1&style=list&optioncount=1&orderby=id&html=1&number=$number&echo=0");
$result .= "$list>";
return $result;
?>