Ahi coloque todo en el archivo que utilizo en vez del index y me da el error
Fatal error: Call to undefined function srtlen() in C:\wamp\www\wp\wp-content\themes\hybrid-news\front-page.php on line 40
Código PHP:
<?php
/*
Template Name: Front Page
*/
get_header(); ?>
<div class="hfeed content">
<?php hybrid_before_content(); // Before content hook ?>
<div id="slider-container">
<div id="slider">
<?php
if ( $news_settings['feature_category'] )
$feature_query = array( 'cat' => $news_settings['feature_category'], 'showposts' => $news_settings['feature_num_posts'], 'caller_get_posts' => 1 );
else
$feature_query = array( 'post__in' => get_option( 'sticky_posts' ), 'showposts' => $news_settings['feature_num_posts'] );
?>
<?php query_posts( $feature_query ); ?>
<?php while ( have_posts() ) : the_post(); $do_not_duplicate[] = $post->ID; ?>
<div class="<?php hybrid_entry_class( 'feature' ); ?>">
<?php get_the_image( array( 'custom_key' => array( 'Medium', 'Feature Image' ), 'default_size' => 'medium' ) ); ?>
<?php hybrid_before_entry(); ?>
<div class="entry-summary entry">
<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
<?php
$title = get_the_title(); //Guardas el título en una variable
$largo = srtlen($title); //Guardas el numero de caracteres de tu titulo
$palabras = ($largo <= 50)?(300):(200); //Si el titulo tiene menos de 50 caracteres (o igual) $palabras sera igual a 300, sino igual a 200
?> <?php the_excerpt_reloaded($palabras) ?> </a>
</div>
<?php hybrid_after_entry(); ?>
</div>
<?php endwhile; wp_reset_query(); ?>
</div>
<div class="slider-controls">
<a class="slider-prev" title="<?php _e('Previous Post', 'news'); ?>"><?php _e('Previous', 'news'); ?></a>
<a class="slider-pause" title="<?php _e('Pause', 'news'); ?>"><?php _e('Pause', 'news'); ?></a>
<a class="slider-next" title="<?php _e('Next Post', 'news'); ?>"><?php _e('Next', 'news'); ?></a>
</div>
</div>
<div id="excerpts">
<?php query_posts( array( 'cat' => $news_settings['excerpt_category'], 'showposts' => $news_settings['excerpt_num_posts'], 'caller_get_posts' => 1, 'post__not_in' => $do_not_duplicate ) ); ?>
<?php while( have_posts() ) : the_post(); $do_not_duplicate[] = $post->ID; ?>
<div class="<?php hybrid_entry_class(); ?>">
<?php get_the_image(); ?>
<?php hybrid_before_entry(); ?>
<div class="entry-summary entry">
<?php the_excerpt(); ?>
</div>
<?php hybrid_after_entry(); ?>
</div>
<?php endwhile; wp_reset_query(); ?>
</div>
<?php if ( !empty( $news_settings['headlines_category'] ) ) : $alt = 'odd'; ?>
<div id="headlines">
<?php foreach ( $news_settings['headlines_category'] as $category ) : ?>
<?php $headlines = get_posts( array(
'numberposts' => $news_settings['headlines_num_posts'],
'category' => $category,
'post__not_in' => $do_not_duplicate
) ); ?>
<?php if ( !empty( $headlines ) ) : ?>
<div class="section <?php echo $alt; ?>">
<?php $cat = get_category( $category ); ?>
<h3 class="section-title"><a href="<? echo get_category_link( $category ); ?>" title="<?php echo $cat->name; ?>"><?php echo $cat->name; ?></a></h3>
<ul>
<?php foreach($headlines as $post) : $do_not_duplicate[] = $post->ID; ?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>
</div>
<?php if ( $i++ % 2 == 0 ) $alt = 'even'; else $alt = 'odd'; ?>
<?php endif; ?>
<?php endforeach; ?>
</div>
<div id="headlines">
<?php foreach ( $news_settings['headlines_category'] as $category ) : ?>
<?php $headlines = get_posts( array(
'numberposts' => $news_settings['headlines_num_posts'],
'category' => $category,
'post__not_in' => $do_not_duplicate
) ); ?>
<?php if ( !empty( $headlines ) ) : ?>
<div class="section <?php echo $alt; ?>">
<?php $cat = get_category( $category ); ?>
<h3 class="section-title"><a href="<? echo get_category_link( $category ); ?>" title="<?php echo $cat->name; ?>"><?php echo $cat->name; ?></a></h3>
<ul>
<?php foreach($headlines as $post) : $do_not_duplicate[] = $post->ID; ?>
<li><a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>"><?php the_title(); ?></a></li>
<?php endforeach; ?>
</ul>
</div>
<?php if ( $i++ % 2 == 0 ) $alt = 'even'; else $alt = 'odd'; ?>
<?php endif; ?>
<?php endforeach; ?>
</div>
<?php endif; ?>
<?php hybrid_after_page(); // After page hook ?>
<?php hybrid_after_content(); // After content hook ?>
</div>
<?php get_footer(); ?>
Desde ya muchas gracias por la ayuda