• hello, this is avi,

    1. i want to trim my post title length on home page, how to do it?
    this is my content.php
    <article id=”post-<?php the_ID(); ?>” <?php post_class(); ?>>
    <?php if ( !is_single() ) twentyfourteen_post_thumbnail(); ?>

    <header class=”entry-header”>
    <?php if ( in_array( ‘category’, get_object_taxonomies( get_post_type() ) ) && twentyfourteen_categorized_blog() ) : ?>
    <div class=”entry-meta”>
    <span class=”cat-links”><?php echo get_the_category_list( _x( ‘, ‘, ‘Used between list items, there is a space after the comma.’, ‘twentyfourteen’ ) ); ?></span>
    </div>
    <?php
    endif;

    if ( is_single() ) :
    the_title( ‘<h1 class=”entry-title”>’, ‘</h1>’ );

    else :
    the_title( ‘<h1 class=”entry-title”>‘, ‘</h1>’ );

    endif;
    ?>

Viewing 4 replies - 1 through 4 (of 4 total)
  • Andrew Nevins

    (@anevins)

    WCLDN 2018 Contributor | Volunteer support

    You could do it with CSS if you want, what do you want it to look like?

    Thread Starter Avi

    (@avi143)

    i just want to trim my title length. line only first 15 word…

    Thread Starter Avi

    (@avi143)

    i try this

    <?php
    $short_title = the_title(”,”,false);
    $short_title = substr($short_title,0,30);
    echo $short_title;
    ?>

    but its just adding another title. could not find witch code to replace. i try to find the_title() in content.php but fail.

    Thread Starter Avi

    (@avi143)

    can we set post title length with css?

Viewing 4 replies - 1 through 4 (of 4 total)
  • The topic ‘how to trim post title in home page.’ is closed to new replies.