Last word of title

Here it is using the original WP stuff, basically I think what you’re asking for in the most simple format:

<?php 
$post_title = get_the_title();
$title_as_array = explode(' ', $post_title);
$last_word = array_pop($title_as_array);
$last_word_with_span = '<span class="whatever">' . $last_word . '</span>';
array_push($title_as_array,$last_word_with_span);
$modified_title = implode(' ', $title_as_array);
echo $modified_title;
?>

Try out this in this PHP sandbox. You can see where I substituted a string of words («here is my title») for the title in the sandbox — it should work like that with get_the_title() too.

Here is what happens after you press «Execute Code», in case you don’t see that.

PS: For an explanation, basically this: 1) gets the title as string, 2) turns that into an array, 3) gets the last item in the array, 4) adds the span html, 5) puts that back onto the end of the title array, 6) turns array into string again, 7) prints it out.

enter image description here

  • EM

  • Articles

  • Style

  • Capitalization

Summary

Capitalize the first, last, and all major words in a book title, headline, or first-level heading. Major words are all words except articles (a, an, the), prepositions (on, in, of, etc.), coordinating conjunctions (and, or, but, etc.), and the word to. This capitalization style is called title case.

Examples

  • Title case: The Curious Incident of the Dog in the Night-Time
  • Title case: The Strange Case of Dr. Jekyll and Mr. Hyde

Capitalize lower-level headings using sentence case, in which only the first word and proper nouns are capitalized (the words that you would normally capitalize in a sentence).

Examples

  • Sentence case: The curious incident of the dog in the night-time
  • Sentence case: The strange case of Dr. Jekyll and Mr. Hyde

Style guides like the AP Stylebook, Chicago Manual of Style, APA Publication Manual, and MLA Handbook prescribe additional rules, discussed in this article.

Capitalization styles

Headings and titles of books, movies, TV shows, articles, and other works can be capitalized using either title case (also called headline style or up style) or sentence case (sentence style or down style).

Examples

  • Title case: How the Grinch Stole Christmas
    Sentence case: How the Grinch stole Christmas
  • Title case: The Idea of Perfection
    Sentence case: The idea of perfection
  • Title case: How to Be a Better Writer
    Sentence case: How to be a better writer

Titles of books, movies, and other works; names of periodicals and magazines; chapter headings; and titles of articles and blog posts are usually capitalized using title case. Sentence-case capitalization is used for second-level headings and lower.

News headlines have traditionally been capitalized using title case, although these days, sentence case is often used, especially online.

In this article, we discuss the general rules of title-case capitalization and then review any additional rules and exceptions prescribed by the major style manuals.

Title case: General rules

Here are the general rules for capitalizing headlines and titles of books, movies, reports, articles, and other works:

  1. Capitalize the first word and last word of a title.
  2. Capitalize all major words, which are all words except articles (a, an, the), prepositions (e.g., on, in, of, at), and coordinating conjunctions (and, or, but, and nor; also for, yet, and so when used as conjunctions).
  3. Always lowercase the word to.
  4. Capitalize the first element of a hyphenated term. Capitalize any subsequent elements only if they are major words.
  5. Capitalize the first word of a subheading following a colon.
  6. Break a rule if you need to—for example, if a preposition is emphasized in a title, capitalize it.

Title case rules explained

Capitalize all major words—all words except articles, prepositions, and coordinating conjunctions.

Examples

  • Love in the Time of Cholera
  • Three Men in a Boat
  • Harry Potter and the Prisoner of Azkaban
  • Requiem for a Dream
  • Catch Me If You Can
  • The Portrait of a Lady
  • The Way We Live Now
  • The Girl Who Played with Fire
  • Men without Women
  • The Ground beneath Her Feet
  • Everything Is Illuminated

Capitalize the first and last words of a title, no matter what they are.

Examples

  • A Clockwork Orange
  • The Mill on the Floss
  • In Search of Lost Time
  • Through a Glass Darkly
  • From Blood and Ash
  • But What If There’s No Chimney?
  • And Then There Were None
  • Something to Answer For
  • Something to Believe In
  • All We Dream Of
  • Where We Come From

Caution

It may not always be clear at first glance whether a word should be capitalized. Check what function it serves in the title.

Examples

  • Capitalize over as an adverb, but lowercase it as a preposition.

    Adverb: The Soup Boiled

    O

    ver

    Preposition: The Light

    o

    ver London

  • Capitalize yet
    as an adverb, but lowercase it as a conjunction.

    Adverb: Are We There

    Y

    et?

    Conjunction: Broke

    y

    et Happy

Always lowercase the word to.

Examples

  • Train to Busan
  • Zero to One: Notes on Startups, or How to Build the Future
  • A Good Man Is Hard to Find

In a hyphenated term, capitalize the first element, but capitalize the following elements only if they are major words.

Examples

  • The Man-Eater of Malgudi

    Eater is a noun and should be capitalized.

  • The Academy’s Out-of-Uniform Procedure

    Lowercase of, which is a preposition, but capitalize uniform, a noun.

  • The Step-by-Step Guide to Finding Fairies
  • The Thirty-Nine Steps
  • The Anti-Inflammatory Diet Cookbook
  • Originals: How Non-Conformists Move the World
  • The Fire-Breathing Dragon

Capitalize the first word of a subtitle or subheading following a colon.

Examples

  • Computer: A History of the Information Machine
  • The Lord of the Rings: The Return of the King
  • The View from the Cheap Seats: Selected Nonfiction
  • A Memoir: Of Mermaids and Waterfalls

Break a rule if you must. If a word is emphasized in a title, capitalize it, even if it is not a major word.

Examples

  • How to Be the Go-To Person in Your Organization
  • A Run-In with Religion and Other True Stories
  • Is It OK to Use And at the Start of a Sentence?

Tip

Capitalize all the words that make up a phrasal verb. (A phrasal verb comprises a verb and a preposition, which together form a single verb with its own meaning.)

Examples

  • What to Do When You Run Into Someone You Don’t Like
  • How to Set Up Your Spaceship’s AI
  • Don’t Put Off Being Happy

Be and is in a title

Capitalize verbs, including the be verb in all its forms: be, is, are, was, were.

Examples

  • There Will Be Blood
  • Tender Is the Night
  • Where the Wild Things Are
  • Then She Was Gone
  • Their Eyes Were Watching God

Also capitalize the have and do verbs in all their forms: have, has, had, do, does, did.

Examples

  • The Heart Has Its Reasons
  • Owls Do Cry
  • What Katy Did
  • Inequality: What Can Be Done?

That in a title

The word that is always a major word and should be capitalized. (In most titles, it is used as a relative pronoun.)

Examples

  • Companies That Fleece Their Customers
  • The House That Jack Built

It and me in a title

Capitalize all pronouns, including it, my, me, we, our, you, he, his, she, her, they, them, and who.

Examples

  • How It All Began
  • Some of My Favorite Things
  • The Best We Can Do
  • The General in His Labyrinth
  • The Woman Who Did

No and not in a title

Capitalize the words no and not (a determiner and an adverb) whenever these words appear in titles.

Examples

  • Beasts of No Nation
  • Oranges Are Not the Only Fruit

AP and APA style

The APA Publication Manual (used in academic editing, especially the social sciences) and the AP Stylebook (preferred in journalism, media, and corporate communication) both specify one major exception to the general rules:

Capitalize all words of four letters or more, even if they are prepositions.

Examples

  • One Flew Over the Cuckoo’s Nest
  • The Girl Who Played With Fire
  • Men Without Women
  • The Ground Beneath Her Feet
  • So Far From God
  • Once Upon a Time in the West
  • Much Ado About Nothing
  • The Light Between Oceans
  • The Cat Who Walks Through Walls
  • A Woman Under the Influence
  • Three Billboards Outside Ebbing, Missouri
  • The World Until Yesterday
  • but

  • The Man in the Brown Suit
  • The Wizard of Oz
  • A Home for Lunatics
  • The Woman on the Beach

Thus, in APA and AP style, words four letters or longer are always capitalized, regardless of function. Note that the other general rules apply as usual. Capitalize any major words, even if they are three letters or shorter: be, has, had, do, did, me, who, my, etc.

Examples

  • We Should All Be Feminists
  • If I Had Your Face
  • Marley and Me
  • The Man Who Sold His Ferrari

Another exception is that all conjunctions three letters or shorter are lowercased. Thus, in APA and AP style, lowercase not only the seven coordinating conjunctions (and, or, but, nor, for, yet, so) but also subordinating conjunctions up to three letters long (which pretty much boils down to the word if).

Examples

  • Pride and Prejudice
  • I’d Tell You I Love You, but Then I’d Have to Kill You
  • Catch Me if You Can

Also, do lowercase articles and any prepositions up to three letters long: a, an, the, for, in, of, to, etc.

Examples

  • The Bridge on the River Kwai
  • Stranger in a Strange Land
  • The Catcher in the Rye
  • A House for Mr. Biswas

Finally, in AP Style, the first and last words are capitalized as usual, regardless of length.

Examples

  • An American Tragedy
  • The Invisible Man
  • As I Lay Dying
  • Of Human Bondage
  • On the Waterfront
  • For the Green Planet
  • Something to Answer For
  • These Times We Live In

However, in APA style, the last word is capitalized only if it is a major word or longer than three letters.

Examples

  • Something to Answer for
  • These Times We Live in

    In APA style, lowercase prepositions, unless they are four letters or longer.

Chicago style

According to the Chicago Manual of Style, the conjunctions to be lowercased are and, or, nor, but, and for. All others are capitalized. Thus, the words yet and so are capitalized regardless of function. The word if is also always capitalized.

Examples

  • Sense and Sensibility
  • The Hobbit, or There and Back Again
  • but

  • Though We Be Dead, Yet Our Day Will Come
  • Even If We Break

In a hyphenated phrase, if the first element is merely a prefix that could not stand by itself (e.g., anti-, pre-, non-), don’t capitalize the second part.

Examples

  • The Anti-inflammatory Diet Cookbook
  • Since the prefix anti- can’t stand by itself, don’t capitalize the second part of the hyphenated term.

    but

  • The Thirty-Nine Steps

    The word thirty can stand by itself, so capitalize nine as well.

Remember to capitalize not just the first but also the last word of a title or heading, even if it is not a major word.

Examples

  • The Things We Believe In

    Capitalize the last word, even a preposition.

  • Only One Way Through
  • It’s You I’m Dreaming Of

MLA style

The MLA Handbook (used in academic writing for the humanities) specifies no exceptions to the general rules.

Examples

  • These Times We Live In
  • A Heartbreaking Work of Staggering Genius
  • The Moon Is a Harsh Mistress

Sentence case

In sentence case, a title is written as a sentence would be: the first word and all proper nouns are capitalized. This capitalization style is generally used for headings that are second level or lower. These days, it is also increasingly being used for online news headlines.

Examples

  • Clear light of day
  • We need to talk about Kevin
  • The quiet American

The first word of a subtitle or subheading that follows a colon is also capitalized.

Examples

  • Traveling with ghosts: A memoir
  • Understanding comics: The invisible art

If a title begins with a numeral, lowercase the next word.

Examples

  • 27 books to read before you die
  • Practice guidelines for the pickling of pineapples: 2019 update

Professional and social titles that precede a name are capitalized as well.

Example

  • The island of Doctor Moreau
  • The strange life of President Farley
  • The story of Father Femy and his music

For more on which words to capitalize in a sentence, see this article on capitalization.

Differences in AP, APA, Chicago, MLA rules

In title case, the first word, proper nouns, and major words of a title or heading are capitalized. Style manuals differ in their guidelines on what qualifies as a “major” word. Here’s a quick summary of the key differences between the popular styles.

In both AP and APA styles, capitalize prepositions four letters or longer. In Chicago and MLA, lowercase all prepositions, regardless of length.

Examples

  • APA, AP: The Girl From Mars
    Chicago, MLA: The Girl from Mars
  • but

  • APA, AP, Chicago, MLA: The Woman in Red

Lowercase not just coordinating but also subordinating conjunctions shorter than four letters in AP and APA styles; capitalize all subordinating conjunctions in Chicago and MLA.

Example

  • APA, AP: Isolate if You Are Sick
    Chicago, MLA: Isolate If You Are Sick

Capitalize the words yet and so in Chicago style. In the other styles, lowercase them when they are used as conjunctions, but capitalize when they are adverbs.

Examples

  • Chicago: Broke Yet Happy
    APA, AP, MLA: Broke yet Happy
  • but

  • Chicago, APA, AP, MLA: Am I Normal Yet?

Capitalize the last word of the title in AP, Chicago, and MLA styles even if it is not a major word; in APA, capitalize the last word only if it is a major word. (But remember that the APA Publication Manual considers all words four letters or longer major words.)

Examples

  • Chicago, MLA, AP: Something to Answer For
    APA: Something to Answer for
  • but

  • Chicago, MLA, APA, AP: The Places We Come From

In all four styles, capitalize the first word (whatever it may be), and lowercase articles.

Example

  • APA, AP, Chicago, MLA: The Girl Who Found a Dragon Egg

I don’t have direct access to the relevant Chicago Manual of Style section, but indirectly, everywhere I look online from Grammar Girl to Capitalize My Title tells me that the last word of the title should always be capitalized regardless of whether or not it’s a conjunction, article, or preposition.

This tool currently does not capitalize the last word of the title if it is one of the words in lower-case.js. For example,

title "what on earth is going on"
# What on Earth Is Going on [copied]

It should return What on Earth Is Going On.

I don’t have direct access to the relevant Chicago Manual of Style section, but indirectly, everywhere I look online from Grammar Girl to Capitalize My Title tells me that the last word of the title should always be capitalized regardless of whether or not it’s a conjunction, article, or preposition.

This tool currently does not capitalize the last word of the title if it is one of the words in lower-case.js. For example,

title "what on earth is going on"
# What on Earth Is Going on [copied]

It should return What on Earth Is Going On.

When including titles of works in your writing, they must be appropriately punctuated. This helps emphasize their importance amongst the rest of the text. Although you may be creative in highlighting them, there are some broadly accepted rules for various titles of different works.

The most important thing to remember is to keep your punctuation consistent from one type of work or material to the next. In order to do that, first you need to understand how titles are categorized. Look at our punctuation guide to help determine which title deserves quotations, italics, or regular type.

How to Punctuate Titles

Grammarist Article Graphic V2 64

How you use capitalizations and punctuation marks in a title are important. Despite having some creative freedom, most online citation style guides offer some helpful advice for consistency. Keep these rules and examples in mind when you are using various types of titles in your writing.

Rule 1: Capitalize the first and last word of a title

Some people believe that an entire title is written in capitalizations, but that isn’t true unless you are using your own creative style. However, be sure always to capitalize the first and last word. 

For example:

  • Lord of the Rings

Rule 2: Capitalize proper nouns, verbs, nouns, and adjectives

Always capitalize any proper nouns, any other nouns, verbs, and adjectives. These make up the bulk of a descriptive title and need to stand out. 

For example:

  • A Journey Through a History of Magic

Rule #3: Capitalize the subordinate conjunctions like, as, or because

Subordinate conjunctions help combine the rest of the words in a descriptive title and should always be capitalized. 

For example:

  • Love Like Me

Rule #4: Capitalize words following a colon

Be sure to capitalize the first word following a colon even if it is an article or coordinating conjunction. The part of a title that follows a colon is important to understanding the overall title and deserves added emphasis. 

For example:

  • Europe: A History

Rule #5: Do not capitalize the articles a, an, and the unless they are the first word of the title

Articles are conjoining words that when capitalized can take away from the main subject of the title. Keep them in lowercase unless they are the first word of the title or follow a colon. 

For example:

  • The Fellowship of the Ring

Rule #6: Do not capitalize the coordinating conjunctions but, and, or, if, or nor

SImilar to rule #5, keep coordinating conjunctions in lowercase unless they are also the first word of a title or follow a colon. 

For example:

  • The Fox and the Hound

Rule #7: Do not capitalize short prepositions of less than five letters

Short prepositions also need to be in lowercase to avoid pulling attention from the main subject of the title. To, at, in, and or are more commonly known, but words such as from, out, or over are also included in this list

For example: 

  • A History at Antietam: A War to Remember

Rule #8: Capitalize a phrasal verb particle

Go away, give over, and push on are examples of phrasal verbs and should be capitalized as they are usually a prominent part of the title. 

For example:

  • How to Push On in Life

Rule #9: Always include any ending marks or punctuation included with the title

Don’t add any punctuation or end marks to a title that does not already include them (unless the title ends the actual sentence it is included in). This consists of any colons, commas, question marks, or exclamation points. 

For example:

  • Why Me? A Story of Survival

Italics vs. Quotations vs. Regular Type

When using titles in your writing you want to indicate to the reader which words represent a title. You do this by making it stand out, and although you can get creative in how you highlight titles, it needs to be consistent in all your writing. Because of that it is sometimes best to follow the accepted rules for title punctuation to help you keep it the same from one text to the next. 

Big Titles vs Little Titles

“Big” titles, such as book titles or album titles, should be italicized. “Little” titles, such chapters in a book or a song title in an album, should be put into quotation marks. 

If you are handwriting, this can be difficult to do. In this situation you will replace the italicized big title with an underline. Leave little titles in quotations. 

For example:

  • I enjoyed Robert Frost’s poem “The Road Less Traveled” in his anthology, Frost’s Greatest Poems.

Works of Art

Works of art, such as paintings and sculptures, are considered a big work and their title should be italicized (or underlined if handwriting). Photography is considered a little work and should be put into quotations. 

For example:

  • Michelangelo’s Pieta is located in the Vatican and is an amazing piece to behold. 

Italics

Italicized titles indicate a more significant work. These include major works and publications in a variety of both print and digital options. The title of anything in print, such as books, plays, newspapers, and magazines are obvious, but italicization also applies to movies and television shows, plays and operas, blogs, legal cases, published journals, epic poems or book-length poems, paintings, and sculptures, and even cartoons and comic strips. 

Quotations

Quotation marks are reserved for shorter titles, or titles related to larger pieces of work. This includes the chapters in books, short stories and poems, articles in magazines and newspapers, blog entries, television episodes, and unpublished materials such as lectures and dissertations. 

Regular Type

Even though it feels natural to highlight titles with either italics or quotations within a block of text, there are some titles that should be left as regular type. These include the titles of awards, online databases and websites, religious works, and political documents. Always follow the same capitalization and punctuation rules, even if the title doesn’t call for italicization or quotation mark use.  

Title Guide

Keep this guide handy to help you remember which publications and other works that have titles should be correctly punctuated.

  • newspapers
  • movies
  • musical compositions 
  • radio shows
  • sculptures
  • blogs
  • legal cases
  • books
  • magazines
  • television shows
  • plays
  • musical albums
  • operas
  • paintings
  • cartoons and comic strips
  • journals
  • long poems 
  • short poems 
  • chapters in books
  • short stories
  • songs
  • blog entries
  • photographs
  • episodes of television shows
  • essays
  • articles in magazines, journals, newspapers, and encyclopedias
  • unpublished manuscripts, speeches, dissertations, theses, and lectures
  • awards
  • musical compositions not identified by name
  • online databases 
  • political documents
  • religious works 
  • sections, books, and prayers within religious works
  • streaming services 
  • websites
  • works of antiquity

Let’s Review

You can reference many titles in your writing, and you want to ensure your readers have a visual of them while they read for contextual purposes. The use of proper punctuation in terms of capitalization, italics, and quotations allows readers to know they are looking at a formal title being referenced within the work.

Понравилась статья? Поделить с друзьями:
  • Last word of shooting star перевод песни
  • Last word of a shooting star скачать
  • Last word of a shooting star mitski перевод
  • Last word of a bluebird
  • Last word latest news