Home ยป Ask (Forum) ยป How to Limit the Title on Heading of Film that Shown on Main Page in Bikin Film

Question

Hi, admin!
Watch the Video,
Reference link: https://moviesware.com/wp-content/uploads/2017/07/Watch-Online-Movies-_-Free-Download-Movies-In-HD-Print-Google-Chrome-27-07-2017-14_21_03.mp4
How to Set the Limit of TEXT on Heading of Film that Shown on Main Page in Bikin Film?
Limit of TEXT will be same for Every Film Heading.

Jul 27, 2017 (3 weeks ago) - Posted by 13 Comments

13 Answers

  1. Mr. Shine says:

    Hello Nasha, do you mean you want limit the title? Is that right? If yes follow the below instruction:
    1. Open functions.php file (inside your wordpress theme).
    2. Scroll to the end of the page and find this line:

    ?>

    3. Before that line add this code:

    function bw_limit_title( $title ){
        return wp_trim_words( $title, 3, '...' );
    }
    add_filter( 'the_title', 'bw_limit_title' );

    Note: 3 is maximum number of words do you want display in title.
    Done.

    Administrator
    • nasha7861122 says:

      It is Not Working, You can Check on my Site

      Register Member
    • nasha7861122 says:

      Its Working.
      But I want to Limit the title only for homepage(main page)
      Through you code, it limit the title in whole website.
      I want: When I open the post then It should show a full name of the post.

      Register Member
  2. nasha7861122 says:

    Its Working ๐Ÿ™‚

    Unregister Member
    • nasha7861122 says:

      Mr. Shine.
      I am waiting for your response

      Register Member
    • Mr. Shine says:

      Sorry, waiting what?

      Administrator
    • nasha7861122 says:

      But I want to Limit the title only for homepage(main page)
      Through you code, it limit the title in whole website.
      I want: When I open the post then It should show a full name of the post.

      Register Member
  3. Mr. Shine says:

    Try use this code:

    Delete Code
    Administrator
  4. Mr. Shine says:

    Replace this code (the first code i give to you):

    Delete Code

    Done

    Administrator
    • nasha7861122 says:

      By Replacing this code, Posts are showing on homepage but when we open it then no title is Showing

      Register Member
    • Mr. Shine says:

      Upsss… Sorry Nasha, i give you the wrong code ๐Ÿ™
      Please delete the above code from your functions.php file.

      Now open index.php file (inside your theme folder) and find this line:

      <h1 class="h1title"><?php echo get_the_title(); ?></h1>

      Change become:

      <h1 class="h1title"><?php echo wp_trim_words( get_the_title(), 3, '...' ); ?></h1>

      Good luck!

      Administrator

Your Answer

Your email address will not be published. Required fields are marked *