Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- <?php
- global $post;
- $args = array( 'posts_per_page' => -1, 'category_name' => 'parents' );
- $myposts = get_posts( $args );
- foreach ( $myposts as $post ) : setup_postdata( $post ); ?>
- <h3 class=""><?php the_title(); ?></h3>
- <div class="">
- <?php the_post_thumbnail( array(500, 300)); ?>
- <div class="">
- <?php $media = get_attached_media( 'image');
- $media_first = array_shift( $media );
- $image_url = $media_first->guid;
- echo '<a href="'. $image_url .'" class="" >Посмотреть</a>';
- foreach ($media as $k => $v) {
- $image_urls = $v->guid;
- echo '<a href="'. $image_urls .'" ></a>';
- }
- ?>
- </div>
- </div>
- <?php add_filter('the_content', 'strip_images',2); ?>
- <?php the_content(); ?>
- <?php endforeach;
- wp_reset_postdata();?>
- //functions.php
- <?php function strip_images($content){
- return preg_replace('/<img[^>]+./','',$content);
- } ?>
Add Comment
Please, Sign In to add comment