Development
Related Programs II Display On single-event.php page
with print_r() we can see what type of info we are getting, an array this case…
Related Programs I
Create a custom field on ACF Field Type Relationship: Filter by Post Type: Program Show this field group if Save
Create a new file named archive-program.php
Because by default A new custom post-type will fall back to arvhive.php main page We need to create a custom
Create A New Custom Post Type “Programs”
Remember to register it under the mu-plugins/custom_post_types.php All page looks like this now: REMEMBER TO SAVE IN PERMALINK SO URL
Creating Past Events Page
Create new page under Admin New Page named Past Events, slug will be past-events Also create a new php file
Install Custom Fields Plugin Instead?
Search for Advanced Custom Fields on Plugins Admin ACF the_field(); the_field(‘event_date’); event_date is created on ACF
After Registering Custom-Fields under MU-Plugins Turn On Additional Fields
Go to edit a page of (in this case ‘Eventes’) Got to Edit 3Dots TOP Right Choose Preferences/ Choose Panels/
register_post_type() Add excerpt ‘supports’ => array(‘title’, ‘editor’, ‘excerpt’),
On custom_post_types.php page created under themes/mu-plugins
if (has_excerpt()) the_excerpt() II
This is the excerpt form the actual post, written in admin
Create New archive-event.php page
This page will show when going to main url/events/
Let’s Create a custom page for Events single-event.php
Under theme/ create anew page single-event.php
Must Use Plugins / mu-plugins folder
Any Plugin that we create under this folder will be automatically called by wordpress. Under wp-content folder, create mu-plugins folder
Custom Post Type Create New Event Section
Under functions.php page register new Post Type problem with this is taht if you change theme’s this would dissapear, so
(get_post_type() ==’post’)
<li <?php if (get_post_type() ==’post’) echo ‘class=”current-menu-item”‘?>><a href=”<?php echo site_url(‘/blog’); ?>”>Blog</a></li>
the_excerpt() VS wp_trim_words()
<?php echo wp_trim_words(get_the_content(), 18) ?> <?php the_excerpt(); ?>
echo paginate_links()
The beauty of echo paginate_links() Automatically create a pagination system for Blog, now index.php;