WordPress.org

Forums

Grab featured images from members area? (4 posts)

  1. bcyber
    Member
    Posted 2 years ago #

    I have wordpress installed in a sub-folder /members area which is password protected using htaccess/apache. I have a non wordpress page in the root which I'm pulling the featured images to. The problem is it's giving the popup login prompt. Anyone know how to get around that?

  2. lettergrade
    Member
    Posted 2 years ago #

    What code or method are you using to pull the featured images to your static html page?

  3. bcyber
    Member
    Posted 2 years ago #

    Here's what I'm doing.

    At the top of body -

    <?php include 'path/to/members/wp-load.php'; ?>

    This is how I'm getting the featured images.

    <?php   $do_not_duplicate = array(); ?>
    				<?php   $mosaics = new WP_Query('posts_per_page=1'); ?>
    				<?php   while ($mosaics->have_posts()) : $mosaics->the_post(); ?>
    				<?php   $do_not_duplicate[] = $post->ID; ?>
    
    				 <?php 
    
    if (class_exists('MultiPostThumbnails')) : 
    
    MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'tour-thumb', NULL,  'post-tour-thumb-thumbnail');
    
    endif;
    
    ?>
    				<?php   endwhile; wp_reset_postdata(); ?>
    
    				</p>
    
    		 		<hr>
    		 		<p><?php   $mosaics = new WP_Query( array( 'posts_per_page' => 1, 'post__not_in' => $do_not_duplicate ) ); ?>
    <?php   while ($mosaics->have_posts()) : $mosaics->the_post(); ?>
    <?php   $do_not_duplicate[] = $post->ID; ?>
    				 <?php 
    
    if (class_exists('MultiPostThumbnails')) : 
    
    MultiPostThumbnails::the_post_thumbnail(get_post_type(), 'tour-thumb', NULL,  'post-tour-thumb-thumbnail');
    
    endif;
    
    ?>
    <?php   endwhile; wp_reset_postdata(); ?></p>
  4. bcworkz
    Member
    Posted 2 years ago #

    Add another .htaccess file to the uploads folder that contains "Satisfy any". This does mean anyone with the correct URL can access any uploads files without a password. You can't have your cake and eat it too.

Topic Closed

This topic has been closed to new replies.

About this Topic