Last active
March 17, 2018 16:08
-
-
Save mklasen/125dc18695fe67df75e85a9bdbd005e6 to your computer and use it in GitHub Desktop.
flex-video-logic.php
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| <?php | |
| register_post_type('video', array( | |
| 'label' => 'Videos'. | |
| 'public' => true, | |
| 'menu_icon' => 'dashicons-video-alt3', | |
| )); | |
| register_taxonomy( 'Category', 'video', array('label' => 'Categories', 'hierarchical' => true)); | |
| add_shortcode('flex-videos', 'flex_videos_shortcode'); | |
| function flex_videos_shortcode() { | |
| $output = ''; | |
| $videos = get_posts(array( | |
| 'post_type' => 'video', | |
| 'numberposts' => -1, | |
| )); | |
| $ouput .= '<ul class="mk-flex-videos">'; | |
| foreach ($videos as $video) { | |
| $output .= '<li><a href="'.get_permalink($video->ID).'">'.$video->post_title.'</a></li>'; | |
| } | |
| $output .= '</ul>'; | |
| return $output; | |
| } | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment