Support

Account

Home Forums Front-end Issues Displaying a group outside WordPress Loop Reply To: Displaying a group outside WordPress Loop

  • Hi @James, This is also not working. May be i am doing something wrong. This code is working inside a tab. Please have a look. This is for showing posts..

    <?php
    // Include WordPress
    define('WP_USE_THEMES', false);
    require_once('../../../../../wp-load.php');
    // Show Posts
    $args = array(
    	'post_type'      => 'post',
    	'posts_per_page' => '6',
    );
    $post_type = new WP_Query( $args );
    if ( $post_type->have_posts() ) {
    	?>
    	<h2>Posts using WP_Query</h2>
    	<?php
    	while ( $post_type->have_posts() ) : $post_type->the_post();
    	?>
    		<article style="padding:0;" class="post type-post entry" itemscope="itemscope" itemtype="http://schema.org/BlogPosting">
    			<header class="entry-header">
    	                	<a style="display:block;margin-bottom:10px;" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
    	                		<?php if ( has_post_thumbnail() ) { the_post_thumbnail('large'); } ?>
    	                	</a>
    	                	<h2 class="entry-title" itemprop="headline"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>">
    			        	<a href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">
    						<?php the_title(); ?>
    					</a>
    				</h2>
    			</header>
    			<div class="entry-content" itemprop="text">
    				<?php the_excerpt(); ?>
    				<a class="more-link" href="<?php the_permalink(); ?>" title="<?php the_title_attribute(); ?>">[Read more...]</a>
    			</div>
    	        </article>
    	<?php
    	endwhile;
    } // if
    wp_reset_postdata();

    I don’t know how to modify this code to fit my group data inside it. Can you please give me an example. Thanks