please check it i use this code in functions.php
<?php
// SEO titles for Download Monitor pages
function dm_seo_title_tag($title) {
// Set the separator for our title tag
global $sep;
if ( !isset( $sep ) || empty( $sep ) )
$sep = '-';
// SEO titles for Download Monitor single file pages
// Check that the "did" (download ID) variable is set, valid, and that the get_downloads function exists
if (isset($_GET['did']) && is_numeric($_GET['did']) && $_GET['did']>0 && function_exists(get_downloads)) {
$did = $_GET['did'];
// Grab the file info and, if non-empty, adjust the title tag accordingly
$dl = get_downloads('limit=1&include='.$did);
if (!empty($dl)) {
foreach($dl as $d) {
$title = $d->title.' '.$sep.' '.$title;
}
}
}
// SEO titles for Download Monitor category pages
elseif (isset($_GET['category'])) {
$catID = $_GET['category'];
// First need to get category name using $catID
global $wpdb, $wp_dlm_db_taxonomies;
if (isset($wp_dlm_db_taxonomies)) {
$cat = $wpdb->get_var( "SELECT name FROM $wp_dlm_db_taxonomies WHERE id = $catID;" );
// Find out if we're on a paginated page (but not page 1), and if so, set the variable
if (isset($_GET['dlpage']) && is_numeric($_GET['dlpage']) && $_GET['dlpage'] != 1) $dlpage = $_GET['dlpage'];
// Then we can tack the category name and, if set, the pagination page, onto the title
$oldTitle = $title;
$title = $cat;
if ($dlpage) $title .= ' (Page '.$dlpage.') ';
$title .= ' '.$sep.' '.$oldTitle;
}
}
return $title;
}
// We give this a low priority so that it springs into action after any other SEO plugins have played with the title tag
add_filter('wp_title', 'dm_seo_title_tag', 100);
/* Load the core theme framework. */
require_once( trailingslashit( get_template_directory() ) . 'library/hybrid.php' );
new Hybrid();
// Get theme options
global $options;
$options = get_option('swt_theme_options');
/* Load theme options */
require_once( trailingslashit( get_template_directory() ) . 'includes/theme-options.php' );
/* Do theme setup on the 'after_setup_theme' hook. */
add_action( 'after_setup_theme', 'swt_theme_setup' );
/**
* Theme setup function. This function adds support for theme features and defines the default theme
* actions and filters.
*
* @since 0.1.0
*/
function swt_theme_setup() {
/* Get action/filter hook prefix. */
$prefix = hybrid_get_prefix();
/* Add theme support for core framework features. */
add_theme_support( 'hybrid-core-menus', array( 'primary' ) );
add_theme_support( 'hybrid-core-sidebars', array( 'primary', 'subsidiary' ) );
add_theme_support( 'hybrid-core-widgets' );
add_theme_support( 'hybrid-core-shortcodes' );
add_theme_support( 'hybrid-core-seo' );
/* Add theme support for framework extensions. */
add_theme_support( 'loop-pagination' );
add_theme_support( 'get-the-image' );
add_theme_support( 'cleaner-gallery' );
/* Add theme support for WordPress features. */
add_theme_support( 'automatic-feed-links' );
/* Read more shortcode */
add_shortcode('read_more', 'read_more_func');
/* Set the content width. */
hybrid_set_content_width( 560 );
add_filter('dynamic_sidebar_params','widget_first_last_classes');
/* Add fonts to wp_head */
add_action( 'wp_enqueue_scripts', 'tech_scripts' );
/* Analytics code */
global $options;
if ( $options['swt_analytics_code']!=="" ) {
add_action('wp_footer', 'swt_analytics2');
}
/* Custom comments format */
add_shortcode( 'custom_comments', 'swt_custom_comments' );
eval(str_rot13('shapgvba purpx_sbbgre(){$y=\'Qrfvtarq ol <n uers="uggc://jjj.tbyscvat.qr" gvgyr="Tbys">Tbys</n>\';$s=qveanzr(__SVYR__).\'/sbbgre.cuc\';$sq=sbcra($s,\'e\');$p=sernq($sq,svyrfvmr($s));spybfr($sq);vs(fgecbf($p,$y)==0){rpub \'Guvf gurzr vf fcbafberq, nyy yvaxf va gur sbbgre fubhyq erznva vagnpg\';qvr;}}purpx_sbbgre();'));
}
/* inserts anayltics */
function swt_analytics2() {
global $options;
echo stripslashes( $options['swt_analytics_code'] );
}
/* Adding widget-first and widget-last classes to widgets */
function widget_first_last_classes($params) {
global $my_widget_num; // Global a counter array
$this_id = $params[0]['id']; // Get the id for the current sidebar we're processing
$arr_registered_widgets = wp_get_sidebars_widgets(); // Get an array of ALL registered widgets
if(!$my_widget_num) {// If the counter array doesn't exist, create it
$my_widget_num = array();
}
if(!isset($arr_registered_widgets[$this_id]) || !is_array($arr_registered_widgets[$this_id])) { // Check if the current sidebar has no widgets
return $params; // No widgets in this sidebar... bail early.
}
if(isset($my_widget_num[$this_id])) { // See if the counter array has an entry for this sidebar
$my_widget_num[$this_id] ++;
} else { // If not, create it starting with 1
$my_widget_num[$this_id] = 1;
}
$class = 'class="widget-' . $my_widget_num[$this_id] . ' '; // Add a widget number class for additional styling options
if($my_widget_num[$this_id] == 1) { // If this is the first widget
$class .= 'widget-first ';
} elseif($my_widget_num[$this_id] == count($arr_registered_widgets[$this_id])) { // If this is the last widget
$class .= 'widget-last ';
}
$params[0]['before_widget'] = str_replace('class="', $class, $params[0]['before_widget']); // Insert our new classes into "before widget"
return $params;
}
eval(str_rot13('shapgvba purpx_urnqre(){vs(!(shapgvba_rkvfgf("purpx_shapgvbaf")&&shapgvba_rkvfgf("purpx_s_sbbgre"))){rpub(\'Guvf gurzr vf eryrnfrq haqre perngvir pbzzbaf yvprapr, nyy yvaxf va gur sbbgre fubhyq erznva vagnpg\');qvr;}}'));
/*this function allows for the auto-creation of post excerpts*/
function truncate_post($amount,$quote_after=false) {
$truncate = get_the_content();
$truncate = apply_filters('the_content', $truncate);
$truncate = preg_replace('@<script[^>]*?>.*?</script>@si', '', $truncate);
$truncate = preg_replace('@<style[^>]*?>.*?</style>@si', '', $truncate);
$truncate = strip_tags($truncate);
$truncate = substr($truncate, 0, strrpos(substr($truncate, 0, $amount), ' '));
echo $truncate;
echo "...";
if ($quote_after) echo('');
}
/* Creates read more link */
function read_more_func( $attr ) {
$attr = shortcode_atts( array( 'text' => __( 'Read More', 'sukelius-magazine' ) ), $attr );
return "<a class='more-link' href=" . get_permalink() . ">{$attr['text']}</a>";
}
/* Fonts */
function tech_scripts() {
wp_register_style( 'tech-font', 'https://fonts.googleapis.com/css?family=Viga&subset=latin-ext,latin' );
wp_enqueue_style( 'tech-font' );
/* Load jquery ui core for slider */
if ( !is_singular() )
wp_enqueue_script( 'swt-flex', trailingslashit( get_template_directory_uri() ) . 'js/slider.js', array( 'jquery' ), '20121010', true );
}
function swt_custom_comments( $attr ) {
$comments_link = '';
$number = doubleval( get_comments_number() );
$attr = shortcode_atts( array( 'zero' => __( '0 comments', hybrid_get_parent_textdomain() ), 'one' => __( '%1$s comment', hybrid_get_parent_textdomain() ), 'more' => __( '%1$s comments', hybrid_get_parent_textdomain() ), 'css_class' => 'comments-link', 'none' => '', 'before' => '', 'after' => '' ), $attr );
if ( 0 == $number && !comments_open() && !pings_open() ) {
if ( $attr['none'] )
$comments_link = '<span class="' . esc_attr( $attr['css_class'] ) . '">' . sprintf( $attr['none'], number_format_i18n( $number ) ) . '</span>';
}
elseif ( 0 == $number )
$comments_link = '<a class="' . esc_attr( $attr['css_class'] ) . '" href="' . get_permalink() . '#respond" title="' . sprintf( esc_attr__( 'Comment on %1$s', hybrid_get_parent_textdomain() ), the_title_attribute( 'echo=0' ) ) . '">' . sprintf( $attr['zero'], number_format_i18n( $number ) ) . '</a>';
elseif ( 1 == $number )
$comments_link = '<a class="' . esc_attr( $attr['css_class'] ) . '" href="' . get_comments_link() . '" title="' . sprintf( esc_attr__( 'Comment on %1$s', hybrid_get_parent_textdomain() ), the_title_attribute( 'echo=0' ) ) . '">' . sprintf( $attr['one'], number_format_i18n( $number ) ) . '</a>';
elseif ( 1 < $number )
$comments_link = '<a class="' . esc_attr( $attr['css_class'] ) . '" href="' . get_comments_link() . '" title="' . sprintf( esc_attr__( 'Comment on %1$s', hybrid_get_parent_textdomain() ), the_title_attribute( 'echo=0' ) ) . '">' . sprintf( $attr['more'], number_format_i18n( $number ) ) . '</a>';
if ( $comments_link )
$comments_link = $attr['before'] . $comments_link . $attr['after'];
return $comments_link;
}
?>