";
return $advert;
}
add_shortcode("ad", "ads");
function visitor_check_shortcode($atts, $content = null) {
if ( ( !is_user_logged_in() && !is_null( $content ) ) || is_feed() )
return $content;
return '';
}
add_shortcode( 'visitor', 'visitor_check_shortcode' );
function member_check_shortcode( $atts, $content = null ) {
if ( is_user_logged_in() && !is_null( $content ) && !is_feed() )
return $content;
return '';
}
add_shortcode( 'member', 'member_check_shortcode' );
//Modify Header for 3D Slideshow
function cu3er_header() {
$url = get_bloginfo('template_directory');
echo "";
echo "";
}
//Set new excerpt for 3D Slideshow
function excerpt($num) {
$limit = $num+1;
$excerpt = explode(' ', get_the_excerpt(), $limit);
array_pop($excerpt);
$excerpt = implode(" ",$excerpt)."...";
echo $excerpt;
}
//Check for Post Thumbnail Support
if ( function_exists( 'add_theme_support' ) )
add_theme_support( 'post-thumbnails' );
//Function to get Thumbnail URL
function get_thumbnail_src() {
if (function_exists('has_post_thumbnail')) {
$post_thumbnail_id = get_post_thumbnail_id( $post_id );
$image_src = wp_get_attachment_image_src( $post_thumbnail_id, $target_size );
$thumbnail_html = get_the_post_thumbnail( $post_id, $size, $attr );
return $image_src[0];
} elseif(get_post_meta($post->ID, 'featured', TRUE)) {
$img = get_post_meta($post->ID, 'featured', TRUE);
return $img;
} else {
}
}
//Limit the Content
function content($limit) {
$content = explode(' ', get_the_content(), $limit);
if (count($content)>=$limit) {
array_pop($content);
$content = implode(" ",$content).'...';
} else {
$content = implode(" ",$content);
}
$content = apply_filters('the_content', $content);
return $content;
}
//Limit the Title
function the_titlesmall($before = '', $after = '', $echo = true, $length = false) {
$title = get_the_title();
$title_length = strlen(get_the_title());
if ( $length && is_numeric($length) ) {
$title = substr( $title, 0, $length );
}
if ($title_length > $length) {
$title = apply_filters('the_titlesmall', $before . $title . $after, $before, $after);
if ($echo)
echo $title;
else
return $title;
} else {
return the_title();
}
}
// Twitter Widget
function twitterfeedwidget() {
include_once(ABSPATH . WPINC . '/feed.php');
$myOptions = get_option('myOptions');
// replace with your twitter name
$twittername = $myOptions['twitter_username'];
// replace with your wordpress theme name
$themename = 'blogified';
// number of posts that should be fetched
$posts = $myOptions['twitter_number'];
// cache time
$seconds = 600;
$error = '
Ooops, looks like there was an error while loading my Twitter feed...
';
// the cache file will be stored in the theme directory (which needs to be writable)
$cache = ABSPATH . 'wp-content/themes/'.$themename.'/twitter.txt';
// if tempfile doesn't exist or was updated more than $seconds ago, create or update it, otherwise load from file
if (!file_exists($cache) || (file_exists($cache) && (filemtime($cache) + $seconds) < time())) {
$feed = fetch_feed('http://twitter.com/statuses/user_timeline.rss?screen_name=' . $twittername);
if (method_exists($feed, 'get_items')) {
$tweets = $feed->get_items(0, $posts);
$result = '
Latest Tweets
';
foreach ($tweets as $t) {
if ($t == end($tweets)) $class = ' last_twitter_item';
$result .= '
';
// get message
$text = $t->get_description();
// get date/time and convert to unix timestamp
$time = strtotime($t->get_date());
// if status update is newer than 1 day, print time as "... ago" instead of date stamp
// human_time_diff() is a Wordpress function
if ((abs(time() - $time)) < 86400) {
$time = human_time_diff($time) . ' ago';
} else {
$time = date(('d F Y'), $time);
}
// make links in messages clickable
$text = preg_replace('/\s([a-zA-Z]+:\/\/[a-zA-Z0-9\_\.\-\/]+)/i',' $1$2', $text);
// make @name clickable
$text = preg_replace('/(@)([a-zA-Z0-9\_]+)/', '@$2', $text);
// display date/time
$result .= '' . $time . '';
// display message without username prefix
$prefixlen = strlen($twittername . ": ");
$result .= '' . utf8_encode(substr($text, $prefixlen, strlen($text) - $prefixlen)) . '';
$result .= '
';
}
$result .= '
';
$file = fopen($cache, 'w');
fwrite($file, $result);
fclose($file);
echo $result;
// if loading from Twitter fails, try loading from the file instead
} else {
if (file_exists($cache)) {
$file = fopen($cache, 'r');
if (filesize($cache) > 0) $filecontent = fread($file, filesize($cache));
fclose($file);
}
if (isset($filecontent)) {
echo $filecontent;
// if loading from the file failed too, display error
} else {
echo $error;
}
}
// if file exists or if it was updated not long ago, load from file straight away
} else {
$file = fopen($cache, 'r');
if (filesize($cache) > 0) $result = fread($file, filesize($cache));
fclose($file);
if (isset($result)) {
echo $result;
} else {
echo $error;
}
}
}
wp_register_sidebar_widget('twitterfeed', __('Twitter Feed'), 'twitterfeedwidget');
// Register Sidebars
register_sidebar(array(
'name' => 'Home Sidebar',
'description' => 'Widgets in this area will be shown in the Sidebar on Homepage',
'before_title' => '
',
'after_title' => '
'));
register_sidebar(array(
'name' => 'Footer Sidebar',
'description' => 'Widgets in this area will be shown in the center footer column',
'before_title' => '
',
'after_widget' => '',
'after_title' => '
'));
// Styling Tag Cloud
function style_tag_cloud($tags)
{
$tags = preg_replace_callback("|(class='tag-link-[0-9]+)('.*?)(style='font-size: )([0-9]+)(pt;')|",
create_function(
'$match',
'$low=1; $high=5; $sz=($match[4]-8.0)/(22-8)*($high-$low)+$low; return "{$match[1]} tagsz-{$sz}{$match[2]}";'
),
$tags);
return $tags;
}
//Loading Theme Options Framework
function admin_styles() {
$url = get_bloginfo('template_directory');
echo '';
echo '';
echo '';
}
add_action('admin_head', 'admin_styles');
$themename = "Blogified";
$shortname = "Blogified";
$options = array (
array( "type" => "open",
"title" => "Navigation Settings"
),
array( "name" => "Exclude Pages from Navigation",
"desc" => "Type in Page IDs you would like to exclude from menu (Seperated by comma).",
"id" => "pages_excl",
"type" => "text",
"std" => ""),
array( "name" => "Limit Pages",
"desc" => "Type in a number to limit the pages being displayed in the menu. Type 0 to show all the Pages. By default the number of pages is limited to 9",
"id" => "pages_limit",
"type" => "text",
"std" => ""),
array( "type" => "close"),
array( "type" => "open",
"title" => "Styling Settings"
),
array( "name" => "Choose a highlight Colour",
"desc" => "Click on the input field and choose a highlight colour, after choosing click on the button on the bottom right of the colour picker",
"id" => "colorpicker",
"type" => "text",
"std" => "#3b3b3b"),
array( "type" => "close"),
array( "type" => "open",
"title" => "Page Template Settings"
),
array( "name" => "Accordion Slider Category ID",
"desc" => "Choose a category ID that will be shown in the Accordion Slider. You can enable the Accordion Slider by choosing it as an Page template.",
"id" => "accordion_cat",
"type" => "text",
"std" => ""),
array( "name" => "3d Slider Category ID",
"desc" => "Choose the category ID you would like to display in the 3d Slider. Select multiple categories seperated by comma. You can enable the 3d Slider by choosing it as an Page template",
"id" => "threed_cat",
"type" => "text",
"std" => ""),
array( "name" => "3d Slider Number",
"desc" => "Decide how many Posts you would like to display as an maximum for the 3d Slideshow.",
"id" => "threed_posts",
"type" => "text",
"std" => ""),
array( "name" => "3d Slider Slicing Effect",
"desc" => "The 3d Slider can slice horizontally or vertically.",
"id" => "threed_slicing",
"options" => array("horizontal", "vertical"),
"type" => "selectnormal",
"std" => "horizontal"),
array( "name" => "3d Slider Sliding direction",
"desc" => "The 3d Slider can slide to the left, right, up, down",
"id" => "threed_direction",
"options" => array("left", "right", "up", "down"),
"type" => "selectnormal",
"std" => "right"),
array( "type" => "close"),
array( "type" => "open",
"title" => "Sidebar Settings"
),
array( "name" => "Show Tab Menu?",
"desc" => "Do you want to show the Tab-Menu in the Sidebar with Recent Comments, Archives, Popular Posts ect.?",
"id" => "tab_show",
"options" => array("yes", "no"),
"type" => "selectnormal",
"std" => ""),
array( "type" => "close"),
array( "type" => "open",
"title" => "Twitter Settings"
),
array( "name" => "Twitter Username",
"desc" => "Please add your Twitter Username here. It will be used for the Twitter Icon and the Twitter Widget.",
"id" => "twitter_username",
"type" => "text",
"std" => ""),
array( "name" => "Number of latest Tweets",
"desc" => "Please choose how many latest Tweets you would like to display in the Twitter Widget.",
"id" => "twitter_number",
"type" => "text",
"std" => ""),
array( "type" => "close"),
array( "type" => "open",
"title" => "Advertisting Settings"
),
array( "name" => "Ad Slot 1",
"desc" => "Insert your Banner link/image link here. You can even insert Google Adsense Code. To show this add use the following shortcode within a post/page: [ad slot=\"1\" align=\"left\"].",
"id" => "ad_slot_1",
"type" => "textarea",
"std" => ""),
array( "name" => "Ad Slot 2",
"desc" => "Insert your Banner link/image link here. You can even insert Google Adsense Code. To show this add use the following shortcode within a post/page: [ad slot=\"2\" align=\"left\"].",
"id" => "ad_slot_2",
"type" => "textarea",
"std" => ""),
array( "name" => "Ad Slot 3",
"desc" => "Insert your Banner link/image link here. You can even insert Google Adsense Code. To show this add use the following shortcode within a post/page: [ad slot=\"3\" align=\"left\"].",
"id" => "ad_slot_3",
"type" => "textarea",
"std" => ""),
array( "type" => "close")
);
// create the Options page on the admin side
function mytheme_add_admin() {
global $themename, $shortname, $options;
if ( $_GET['page'] == basename(__FILE__) ) {
if ( 'save' == $_REQUEST['action'] ) {
$myOptions = array();
foreach ($options as $value) {
$myOptions[$value['id']]=$_REQUEST[ $value['id'] ];
}
update_option('myOptions', $myOptions);
if( isset( $_REQUEST[ $value['id'] ] ) ) {
update_option('myOptions', $myOptions);
} else {
delete_option( $value['id'] );
}
header("Location: themes.php?page=functions.php&saved=true");
die;
} else if( 'reset' == $_REQUEST['action'] ) {
foreach ($options as $value) {
delete_option( $value['id'] ); }
header("Location: themes.php?page=functions.php&reset=true");
die;
}
}
// Add Options page to the admin menu
add_theme_page($themename." Options", "$themename Options", 'edit_themes', basename(__FILE__), 'mytheme_admin');
}
function mytheme_admin() {
global $themename, $shortname, $options;
?>
Blogified
Dontators who donate at least $5 will receive a lifetime backlink from our Supporters Page.
(write an E-Mail with link and linktext to supporters@wp-themix.org if you have made an donation).
Blogified Options Page
'.$themename.' settings saved.
';
if ( $_REQUEST['reset'] ) echo '
'.$themename.' settings reset.
';
?>
Thumbnails not working - Please give write permission to Theme (blogified) Folder (755 or 777)
You cannot upload images because the folder "wp-content/themes/blogified/images/logos/ is not writeable please CHMOD this folder to 755 or 777
Custom Logo
Select your Logo to upload. Your Logo should not be higher than 130px. The width can be up to 600px. You can only upload PNG or GIF (Logo has to have transparent background).