How can i automatically add CPT single pages as sub menu items

This should work: add_filter( ‘wp_get_nav_menu_items’, ‘cpt_locations_filter’, 10, 3 ); function cpt_locations_filter( $items, $menu, $args ) { $child_items = array(); $menu_order = count($items); $parent_item_id = 0; foreach ( $items as $item ) { if ( in_array(‘locations-menu’, $item->classes) ){ //add this class to your menu item $parent_item_id = $item->ID; } } if($parent_item_id > 0){ foreach ( get_posts( … Read more

Display Repeatable Meta Box Content

Here’s a tested and working version of the template code, which displays the repeatable $emergency_contact_meta correctly: $member_contact_meta = get_post_meta( get_the_ID(), ‘tcp’, true ); echo ‘<strong>Phone: </strong>’ . $member_contact_meta . ‘<br />’; $emergency_contact_meta = get_post_meta( get_the_ID(), ‘repeatable_fields’, true); if ( $emergency_contact_meta ) { echo ‘<strong>Emergency Contacts:</strong><br />’; foreach ( $emergency_contact_meta as $emergency_contact_metas ) { echo ‘<strong>’ … Read more