Create Programs custom post type and make relation between program and event
First we create custom post type for programs so go to mu-plugins and open php file for custom post.
In university_post_types() copy event post type code and repeat this code inside function and rename the things.
In program custom post type code remove excerpt from supports and add icon dashicons-awards
After that go to dashboard create Math program with dummy text and publish and also go permalinks and update
Now this program single post use single.php but i want create dedicated page for this like single-program.php
Now copy code from single-event.php and paste in single-program.php
Now change metabox like below code
and save
Now to display program archive we have to create archive-program.php page
and copy archive-event.php code and paste in archive-program.php page
And change title All Program also make empty while loop we will change design for program display.
add below code ->
and save now i want display program alphabet order so we have to write code in functions.php
Now go to university_adjust_queries() function and add below code
and save
Now make relation between Program and Events.
Go to Custom fields and create new give title Related Program and label Related Program(s)
field name related_programs field type Relationship
Filter by post type - program and Filters only Search
Location rules post type -> event
Now make save changes
Now edit any events you will see custom fields for Programs and add program and save change.
Comments
Post a Comment