Skip to content

Instantly share code, notes, and snippets.

@mklasen
Last active March 17, 2018 16:08
Show Gist options
  • Save mklasen/125dc18695fe67df75e85a9bdbd005e6 to your computer and use it in GitHub Desktop.
Save mklasen/125dc18695fe67df75e85a9bdbd005e6 to your computer and use it in GitHub Desktop.
flex-video-logic.php
<?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