This members-only tutorial provides the steps to define a custom function that takes in a Custom Post Type name as an argument and returns the title of that post type's latest entry.

Once the function has been added,

echo wpdd_get_latest_cpt_title( 'project' );

for example, would output the title of latest project CPT entry.

If no parameter is supplied, title of the latest post will be returned.

If you use Oxygen, you can add a Heading or a Text component, double click on it and paste in

function does not exist

to have the title of project CPT be output.

Step 1

Install and activate Code Snippets plugin.

Go to Snippets > Add New.

Title: [Function] Get the Latest CPT Entry Title

Code:

This is a premium members-only content.

To view the rest of the content, please sign up for membership ($27/month).

Already a member? Log in below or here.

Need help implementing a tutorial in your site or want to hire me for custom work?

HIRE ME

Find the article helpful and wish to donate?

DONATE

Comments

For adding code blocks wrap the code in three backticks. Markdown should work.
Provide a URL of your site/webpage if something is not working.
magnifiercross
>
linkedin facebook pinterest youtube rss twitter instagram facebook-blank rss-blank linkedin-blank pinterest youtube twitter instagram
%d bloggers like this: