LLM Prompts

Crafting Effective Custom Post Type Definitions for WordPress

Generates optimized definitions for WordPress Custom Post Types.

The method

Use these prompts in any LLM. Copy and paste. Iterate on responses. Ideal for WordPress developers seeking efficient CPT creation. Refine based on your project’s unique data structures and relationship needs, testing thoroughly.

The prompts

Prompt 1
I need to define a custom post type for 'Books' in my WordPress theme. Each book should have the following custom fields: 'author' (text), 'publication_date' (date), 'isbn' (text), and 'genre' (taxonomy). Generate the PHP code required to register this custom post type and its associated meta boxes for the custom fields. Include comments to explain each section of the code. Ensure that the code follows WordPress coding standards and is optimized for performance. Also include instructions on how to display these custom fields in a single book template.
Prompt 2
I am working on a WordPress plugin for managing 'Events'. I want to create a custom post type called 'event' with custom fields for 'event_date' (date), 'event_time' (time), 'location' (text), and 'organizer' (text). Additionally, I need to create a custom taxonomy called 'event_category' to categorize the events. Generate the code needed to register the custom post type and the custom taxonomy. Also, generate the code to create meta boxes for the custom fields. Ensure the code is well-documented and utilizes WordPress best practices. Include a section describing how to query and display events based on the 'event_date'.
Prompt 3
My WordPress site needs a 'Portfolio' section. Create a custom post type for 'portfolio_item' with custom fields like 'project_description' (textarea), 'client' (text), 'project_url' (URL), and a gallery for images. Also, incorporate a custom taxonomy called 'project_type' to categorize different portfolio items. Generate the PHP code required to register the custom post type and its associated meta boxes. The gallery functionality should allow users to upload multiple images to the post. Provide the code to display these custom fields and the gallery in a specific portfolio item template. Make the solution secure and avoid any potential vulnerabilities.