Başlıkta da belirttiğim gibi anasayfada yazıyı 30 karakter ile kesmeye çalışıyorum.
Genelde fonksiyon.php içine bu şekilde excerpt ekleyince 25 kelimede kesiliyordu bu temada olmadı
add_filter('excerpt_length', create_function('$a', 'return 25;'));
Şimdi fonksiyon kodlarını paylaşayım aşağıda sizde nasıl kesebilirim bir yol gösterin belki halledebiliriz :)
/**
* tdphotographer functions and definitions
*
* @package tdphotographer
*/
/**
* Set the content width based on the theme's design and stylesheet.
*/
if ( ! isset( $content_width ) )
$content_width = 640; /* pixels */
if ( ! function_exists( 'tdphotographer_setup' ) ) :
/**
* Sets up theme defaults and registers support for various WordPress features.
*
* Note that this function is hooked into the after_setup_theme hook, which runs
* before the init hook. The init hook is too late for some features, such as indicating
* support post thumbnails.
*/
function tdphotographer_setup() {
/**
* Make theme available for translation
* Translations can be filed in the /languages/ directory
* If you're building a theme based on tdphotographer, use a find and replace
* to change 'tdphotographer' to the name of your theme in all the template files
*/
load_theme_textdomain( 'tdphotographer', get_template_directory() . '/languages' );
/**
* Add default posts and comments RSS feed links to head
*/
add_theme_support( 'automatic-feed-links' );
/**
* Enable support for Post Thumbnails on posts and pages
*
* @link http://codex.wordpress.org/Function_Reference/add_theme_support #Post_Thumbnails
*/
add_theme_support( 'post-thumbnails', array( 'post', 'page', 'product' ) );
/**
* This theme uses wp_nav_menu() in one location.
*/
register_nav_menus( array(
'primary' => __( 'Primary Menu', 'tdphotographer' ),
'top' => __( 'Top Menu', 'tdphotographer' ),
) );
/**
* Enable support for Post Formats
*/
add_theme_support( 'post-formats', array( 'aside', 'status', 'gallery', 'audio', 'image', 'video', 'quote', 'link' ) );
}
endif; // tdphotographer_setup
add_action( 'after_setup_theme', 'tdphotographer_setup' );
/**
* Register widgetized area and update sidebar with default widgets
*/
function tdphotographer_widgets_init() {
register_sidebar( array(
'name' => __( 'Sidebar', 'tdphotographer' ),
'id' => 'sidebar-1',
'before_widget' => '',
'before_title' => '',
'after_title' => '
',
) );
if( tdphotographer_is_footer_widgets() ) {
register_sidebar( array(
'name' => __( 'Footer #1', 'tdphotographer' ),
'id' => 'footer-1',
'before_widget' => '',
'before_title' => '',
'after_title' => '
',
) );
register_sidebar( array(
'name' => __( 'Footer #2', 'tdphotographer' ),
'id' => 'footer-2',
'before_widget' => '',
'before_title' => '',
'after_title' => '
',
) );
register_sidebar( array(
'name' => __( 'Footer #3', 'tdphotographer' ),
'id' => 'footer-3',
'before_widget' => '',
'before_title' => '',
'after_title' => '
',
) );
}
}
add_action( 'widgets_init', 'tdphotographer_widgets_init' );
/**
* Enqueue scripts and styles
*/
function tdphotographer_scripts() {
wp_enqueue_style( 'tdphotographer-google-body-fonts', '//fonts.googleapis.com/css?family=Arimo:400,700&subset=latin,latin-ext' );
wp_enqueue_style( 'tdphotographer-google-h-fonts', '//fonts.googleapis.com/css?family=Raleway:400,300,700' );
wp_enqueue_style( 'tdphotographer-css-framework', get_template_directory_uri() . '/css/bootstrap.min.css' );
wp_enqueue_style( 'tdphotographer-icons', get_template_directory_uri() . '/css/font-awesome.min.css' );
wp_enqueue_style( 'tdphotographer-slider-style', get_template_directory_uri() . '/css/jquery.bxslider.css' );
wp_enqueue_style( 'tdphotographer-colorbox-style', get_template_directory_uri() . '/css/colorbox.css' );
if ( class_exists( 'woocommerce' ) ) {
wp_enqueue_style('woocommerce-css', plugins_url() .'/woocommerce/assets/css/woocommerce.css' );
}
wp_enqueue_style( 'tdphotographer-style', get_stylesheet_uri() );
if ( tdphotographer_get_color_scheme() ) {
wp_enqueue_style( 'tdphotographer-color-scheme', get_template_directory_uri() . '/css/color-scheme/'.tdphotographer_get_color_scheme().'.css' );
}
wp_enqueue_script( 'tdphotographer-navigation', get_template_directory_uri() . '/js/navigation.js', array(), '20120206', true );
wp_enqueue_script( 'tdphotographer-skip-link-focus-fix', get_template_directory_uri() . '/js/skip-link-focus-fix.js', array(), '20130115', true );
if ( is_singular() && comments_open() && get_option( 'thread_comments' ) ) {
wp_enqueue_script( 'comment-reply' );
}
if ( is_singular() && wp_attachment_is_image() ) {
wp_enqueue_script( 'tdphotographer-keyboard-image-navigation', get_template_directory_uri() . '/js/keyboard-image-navigation.js', array( 'jquery' ), '20120202' );
}
if( tdphotographer_is_background_image() ) {
wp_enqueue_script( 'tdphotographer-background-script', get_template_directory_uri() . '/js/backstretch.js', array( 'jquery' ), '201301', true );
}
if( is_front_page() && tdphotographer_is_home_audio() && floatval (get_bloginfo('version') ) >= 3.6 ) {
wp_enqueue_script( 'wp-mediaelement' );
}
if( floatval (get_bloginfo('version') ) <= 3.5 ) {
wp_enqueue_script( 'tdphotographer-main-mediaelement', get_template_directory_uri() . '/js/mediaelement-and-player.js', array( 'jquery' ), '201301', true );
wp_enqueue_script( 'tdphotographer-wp-mediaelement', get_template_directory_uri() . '/js/wp-mediaelement.js', array( 'jquery' ), '201301', true );
}
if( floatval (get_bloginfo('version') ) <= 3.5 ) {
wp_enqueue_style( 'tdphotographer-mediaelement-css', get_template_directory_uri() . '/css/mediaelementplayer.css' );
wp_enqueue_style( 'tdphotographer-wp-mediaelement-css', get_template_directory_uri() . '/css/wp-mediaelement.css' );
}
if( tdphotographer_is_smooth_scroll() ) {
wp_enqueue_script( 'tdphotographer-smooth-scroll', get_template_directory_uri() . '/js/jquery.nicescroll.min.js', array( 'jquery' ), '201301', true );
}
if( !is_singular() && tdphotographer_is_infinite_scroll() ) {
wp_enqueue_script( 'tdphotographer-infinitescroll-script', get_template_directory_uri() . '/js/jquery.infinitescroll.min.js', array( 'jquery' ), '201301' );
}
if( is_front_page() && tdphotographer_home_body_class() === 'home-simple-video' ) {
wp_enqueue_script( 'tdphotographer-modernizr-script', get_template_directory_uri() . '/js/modernizr.custom.js', array( 'jquery' ), '201301' );
wp_enqueue_script( 'tdphotographer-videojs-script', get_template_directory_uri() . '/js/video.js', array( 'jquery' ), '201301' );
wp_enqueue_script( 'tdphotographer-videoui-script', get_template_directory_uri() . '/js/jquery-ui-1.8.22.custom.min.js', array( 'jquery' ), '201301' );
wp_enqueue_script( 'tdphotographer-bigvideo-script', get_template_directory_uri() . '/js/bigvideo.js', array( 'jquery' ), '201301' );
}
if( tdphotographer_can_have_bg_slideshow() ) {
wp_enqueue_style( 'tdphotographer-supersized-css', get_template_directory_uri() . '/css/supersized.css' );
wp_enqueue_script( 'tdphotographer-supersized', get_template_directory_uri() . '/js/supersized.3.2.7.js', array( 'jquery' ), '201301' );
wp_dequeue_script( 'tdphotographer-background-script' );
}
wp_enqueue_script( 'tdphotographer-fitvids', get_template_directory_uri() . '/js/jquery.fitvids.js', array( 'jquery' ), '201301', true );
wp_enqueue_script( 'tdphotographer-easing', get_template_directory_uri() . '/js/jquery.easing.js', array( 'jquery' ), '201301', true );
wp_enqueue_script( 'tdphotographer-isotope', get_template_directory_uri() . '/js/jquery.isotope.min.js', array( 'jquery' ), '201301' );
wp_enqueue_script( 'tdphotographer-isotope-fix', get_template_directory_uri() . '/js/jquery.isotope.sloppy-masonry.min.js', array( 'jquery' ), '201301' );
wp_enqueue_script( 'tdphotographer-bxslider', get_template_directory_uri() . '/js/jquery.bxslider.min.js', array( 'jquery' ), '201301' );
wp_enqueue_script( 'tdphotographer-colorbox', get_template_directory_uri() . '/js/jquery.colorbox-min.js', array( 'jquery' ), '201301', true );
wp_enqueue_script( 'tdphotographer-script', get_template_directory_uri() . '/js/tdphotographer.js', array( 'jquery' ), '201301', true );
$tdphotographer_params = array(
'templateDir' => get_template_directory_uri(),
'infinitescroll' => tdphotographer_is_infinite_scroll(),
'infinitescrollImg' => get_template_directory_uri() . '/images/loader.gif',
'infinitescrollLoadMsg' => __( 'Loading the next set of posts', 'tdphotographer' ),
'infinitescrollFinishedMsg' => __( 'All posts loaded.', 'tdphotographer' ),
'backgroundImage' => tdphotographer_is_background_image(),
'backgroundVideo' => json_encode( tdphotographer_get_home_simpe_video_upload() ),
'smoothScroll' => tdphotographer_is_smooth_scroll(),
'mayLikePosts' => tdphotographer_is_may_like_section(),
'rightClick' => tdphotographer_right_click(),
'fixedHeader' => tdphotographer_is_fixed_header()
);
wp_localize_script( 'tdphotographer-script', 'tdphotographerParams', $tdphotographer_params );
}
add_action( 'wp_enqueue_scripts', 'tdphotographer_scripts' );
/**
* Add custom style/script to website head
* @since tdphotographer 1.0
*/
function tdphotographer_head() {
echo '' . "\n";
echo tdphotographer_custom_styles();
}
add_action('wp_head', 'tdphotographer_head');
/**
* Make Audio Player responsive
* @since tdphotographer 1.0
*/
function tdphotographer_audio_shortcode( $html ){
return str_replace('}
add_filter('wp_audio_shortcode', 'tdphotographer_audio_shortcode');
/**
* Remove text after comment textarea
* @since tdphotographer 1.0
*/
function tdphotographer_remove_comment_styling_prompt($defaults) {
$defaults['comment_notes_after'] = '';
return $defaults;
}
add_filter('comment_form_defaults', 'tdphotographer_remove_comment_styling_prompt');
/**
* Add Custom Social Fields to User Profile Page
* @since tdphotographer 1.0
*/
function tdphotographer_custom_contact_fields( $profile_fields ) {
$profile_fields['twitter'] = __( 'Twitter Username', 'tdphotographer' );
$profile_fields['facebook'] = __( 'Facebook URL', 'tdphotographer' );
$profile_fields['gplus'] = __( 'Google+ URL', 'tdphotographer' );
return $profile_fields;
}
add_filter('user_contactmethods', 'tdphotographer_custom_contact_fields');
/**
* Removes Images dimentions
* @since tdphotographer 1.0
*/
function tdphotographer_remove_img_dimensions( $html ) {
$html = preg_replace( '/(width|height)=["\']\d*["\']\s?/', "", $html );
return $html;
}
add_filter('post_thumbnail_html', 'tdphotographer_remove_img_dimensions', 10);
/**
* Custom template tags for this theme.
*/
require get_template_directory() . '/inc/template-tags.php';
/**
* Custom functions that act independently of the theme templates.
*/
require get_template_directory() . '/inc/extras.php';
/**
* Custom Widgets
*/
require get_template_directory() . '/inc/widgets.php';
/**
* Slightly Modified Options Framework
*/
require_once ('admin/index.php');
if( in_array( 'woocommerce/woocommerce.php', apply_filters( 'active_plugins', get_option( 'active_plugins' ) ) ) ) {
require get_template_directory() . '/inc/theme-woocommerce.php';
}