ozturk adlı üyeden alıntı

Tema function.php içeriğini yazabilir misiniz?


include_once(TEMPLATEPATH . '/includes/ShortCodes.php');
include_once(TEMPLATEPATH . '/includes/FluidColumn.php');
include_once(TEMPLATEPATH . '/includes/Video/Video.php');

function the_excerpt_max_charlength($charlength) {
$excerpt = get_the_excerpt();
$charlength++;
if(strlen($excerpt)>$charlength) {
$subex = substr($excerpt,0,$charlength-5);
$exwords = explode(" ",$subex);
$excut = -(strlen($exwords[count($exwords)-1]));
if($excut<0) {
echo substr($subex,0,$excut);
} else {
echo $subex;
}
echo "[...]";
} else {
echo $excerpt;
}
}

/**
* A pagination function
* @param integer $range: The range of the slider, works best with even numbers
* Used WP functions:
* get_pagenum_link($i) - creates the link, e.g. http://site.com/page/4
* previous_posts_link(' « '); - returns the Previous page link
* next_posts_link(' » '); - returns the Next page link
*/
function get_pagination($range = 4, $id=''){
$return='';
// $paged - number of the current page
global $paged, $wp_query;
// How much pages do we have?
if ( !$max_page ) {
$max_page = $wp_query->max_num_pages;
}
// We need the pagination only if there are more than 1 page
if($max_page > 1){
if(!$paged){
$paged = 1;
}
// On the first page, don't put the First page link
if($paged != 1){
$return.=" First ";
}
// To the previous page
$return.= get_previous_posts_link(' « ');
// We need the sliding effect only if there are more pages than is the sliding range
if($max_page > $range){
// When closer to the beginning
if($paged < $range){
for($i = 1; $i <= ($range + 1); $i++){
if($i==$paged) $return.=''.$i.'';
else $return.="".$i."";
}
}
// When closer to the end
elseif($paged >= ($max_page - ceil(($range/2)))){
for($i = $max_page - $range; $i <= $max_page; $i++){
if($i==$paged) $return.=''.$i.'';
else $return.="".$i."";
}
}
// Somewhere in the middle
elseif($paged >= $range && $paged < ($max_page - ceil(($range/2)))){
for($i = ($paged - ceil($range/2)); $i <= ($paged + ceil(($range/2))); $i++){
if($i==$paged) $return.=''.$i.'';
else $return.="".$i."";
}
}
}
// Less pages than the range, no sliding effect needed
else{
for($i = 1; $i <= $max_page; $i++){
if($i==$paged)$return.=''.$i.'';
else $return.="".$i."";
}
}
// Next page
$return.= get_next_posts_link(' » ');
// On the last page, don't put the Last page link
if($paged != $max_page){
$return.=" Last ";
}
}
return('');
}

if (is_admin() && $_GET['page']=='options') {
wp_deregister_script( 'jquery' );
wp_register_script('jquery', get_bloginfo('template_directory').'/scripts/jquery-1.6.1.js');
wp_enqueue_script('jquery');
add_action('wp_print_scripts', 'loadGlobalVariableJs');
}
function loadGlobalVariableJs() {
global $wordPressThemeOptions;
global $current_user;
$themeData=get_theme_data(TEMPLATEPATH.'/style.css');
get_currentuserinfo();
?>
<script>
/* var Global = {
registerEmail: "user_email));?>",
themeName: "",
userDisplayName: "display_name));?>"
};
/* ]]> */
</script>
}


add_filter('widget_text', 'do_shortcode');

if( function_exists( 'add_theme_support' ) ) {
add_theme_support( 'post-thumbnails' );
add_image_size( 'smallgalthumb', 90, 60, true );
add_image_size( 'secondary-slider', 370, 250, true );
add_image_size( 'largegalthumb', 550, 269, true );
add_image_size( 'hotleft', 205, 148, true );
add_image_size( 'business-news', 300, 150, true );
add_image_size( 'entertainment-news', 191, 150, true );
add_image_size( 'art', 220, 288, true );
add_image_size( 'sport', 200, 200, true );
add_image_size( 'world', 200, 200, true );
add_image_size( 'technology', 230, 200, true );
add_image_size( 'health', 230, 200, true );
add_image_size( 'thehot', 80, 80, true );
add_image_size( 'vidpic', 130, 125, true );
add_image_size( 'archiveimg', 145, 85, true );
add_image_size( 'latestgamingupdates', 100, 68, true );
}

function magazine3_ticker( $no_posts = 5, $before = '
  • ', $after = '
  • ', $hide_pass_post = true, $skip_posts = 0, $show_excerpts = false, $include_pages = false ) {
    global $wpdb;

    $time_difference = get_settings( 'gmt_offset' );
    $now = gmdate( "Y-m-d H:i:s", time() );
    $request = "SELECT ID, post_title, post_excerpt FROM $wpdb->posts WHERE post_status = 'publish' ";
    if ( $hide_pass_post )
    $request .= "AND post_password ='' ";
    if ( $include_pages )
    $request .= "AND (post_type='post' OR post_type='page') ";
    else
    $request .= "AND post_type='post' ";
    $request .= "AND post_date_gmt < '$now' ORDER BY post_date DESC LIMIT $skip_posts, $no_posts";
    $posts = $wpdb->get_results( $request );
    $output = '';

    if ( $posts ) {
    foreach ( $posts as $post ) {
    $post_title = $post->post_title;
    $permalink = get_permalink( $post->ID );
    $output .= $before . '' . esc_html( $post_title ) . '';
    if ( $show_excerpts ) {
    $post_excerpt = esc_html( $post->post_excerpt );
    $output.= '
    ' . $post_excerpt;
    }
    $output .= $after;
    }
    } else {
    $output .= $before . "None found" . $after;
    }
    echo $output;
    }
    add_theme_support( 'menus' );

    if ( function_exists( 'wp_nav_menu' ) ){
    if (function_exists('add_theme_support')) {
    add_theme_support('nav-menus');
    add_action( 'init', 'register_my_menus' );
    function register_my_menus() {
    register_nav_menus(
    array(
    'main-menu' => __( 'Top Menu' )
    )
    );
    }
    register_nav_menus( array(
    'second' => __( 'Main Menu', 'second' ),
    ) );

    register_nav_menus( array(
    'third' => __( 'Under Main Menu', 'third' ),
    ) );

    register_nav_menus( array(
    'fourth' => __( 'Footer Menu', 'fourth' ),
    ) );

    }
    }
    function primarymenu1(){ ?>




    • Go to DASHBOARD > Appearance > Menus to set up the menu.





    function primarymenu2(){ ?>


    function primarymenu3(){ ?>



    • Go to DASHBOARD > Appearance > Menus to set up the menu.




    class Arrow_Walker_Nav_Menu extends Walker_Nav_Menu {
    function display_element($element, &$children_elements, $max_depth, $depth=0, $args, &$output) {
    $id_field = $this->db_fields['id'];
    if (!empty($children_elements[$element->$id_field])) {
    $element->classes[] = 'arrow'; //enter any classname you like here!
    }
    Walker_Nav_Menu::display_element($element, $children_elements, $max_depth, $depth, $args, $output);
    }
    }
    function the_content_limit($max_char, $more_link_text = ' ', $stripteaser = 0, $more_file = '') {
    $content = get_the_content($more_link_text, $stripteaser, $more_file);
    $content = apply_filters('the_content', $content);
    $content = str_replace(']]>', ']]>', $content);
    $content = strip_tags($content);
    if (strlen($_GET['p']) > 0) {
    echo "

    ";
    echo $content;
    echo " "."..";
    echo "

    ";
    }

    else if ((strlen($content)>$max_char) && ($espacio = strpos($content, " ", $max_char ))) {
    $content = substr($content, 0, $espacio);
    $content = $content;
    echo "

    ";
    echo $content;
    echo "...";
    echo " ".$more_link_text."";
    echo "

    ";
    }

    else {
    echo "

    ";
    echo $content;
    echo " "."";
    echo "

    ";
    }

    }

    function the_title2($before = '', $after = '', $echo = true, $length = false) {
    $title = get_the_title();
    if ( $length && is_numeric($length) ) {
    $title = substr( $title, 0, $length );
    }

    if ( strlen($title)> 0 ) {
    $title = apply_filters('the_title2', $before . $title . $after, $before, $after);
    if ( $echo )
    echo $title;
    else
    return $title;
    }
    }



    register_sidebar( array(
    'name' => 'Homepage sidebar',
    'description' => __( 'The primary widget area on Homepage'),
    'before_widget' => '
  • ',
    'after_widget' => '