short
Signed-off-by: Jeff <jeff@gotenzing.com>
Showing
1 changed file
with
26 additions
and
0 deletions
| ... | @@ -43,3 +43,29 @@ function add_linebreak_shortcode() { | ... | @@ -43,3 +43,29 @@ function add_linebreak_shortcode() { |
| 43 | return '<br />'; | 43 | return '<br />'; |
| 44 | } | 44 | } |
| 45 | add_shortcode('br', 'add_linebreak_shortcode' ); | 45 | add_shortcode('br', 'add_linebreak_shortcode' ); |
| 46 | |||
| 47 | |||
| 48 | |||
| 49 | |||
| 50 | add_shortcode('list_media', 'list_media'); | ||
| 51 | |||
| 52 | |||
| 53 | function list_media($atts){ | ||
| 54 | ob_start(); | ||
| 55 | |||
| 56 | $args = array( 'posts_per_page' => -1, 'post_type' => 'attachment'); | ||
| 57 | $pages = get_posts( $args ); | ||
| 58 | foreach ( $pages as $page ){ | ||
| 59 | $exclude_from_search = get_post_meta($page->ID, 'exclude_from_search', true); | ||
| 60 | if($exclude_from_search == '0'){ ?> | ||
| 61 | <a href='<?php echo get_permalink($page->ID);?>' > | ||
| 62 | <?= get_the_title($page->ID) ?> | ||
| 63 | </a><br><br> | ||
| 64 | <?php } | ||
| 65 | } | ||
| 66 | |||
| 67 | wp_reset_query(); | ||
| 68 | $output = ob_get_clean(); | ||
| 69 | return $output; | ||
| 70 | |||
| 71 | } | ||
| ... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
-
Please register or sign in to post a comment