• Resolved ryanmiller732

    (@ryanmiller732)


    I’m developing my first theme and so am fairly unexperienced at this. My main problem now is that the first loop I’ve tried to write is only outputting 1 item, and it’s a link to the homepage (not any of the arguments passed in the array).

    Here’s the page I am working on: https://tm34marketing.com/

    And here is the php and html:

    <div class="services_list">
    
    	    	    <?php
    					$args = array(
    						'posts_per_page'=>	999,
    						'orderby'		=>	'menu_order',
    						'order'			=>	'ASC',
    						'post_type'		=>	'service',
    						'meta_key'		=>	'featured',
    						'meta_value'	=>	'1'
    					);
    				// The Query
    				get_posts( $args );
    				// The Loop
                	while ( have_posts() ) : the_post(); ?>
    					<div class="service_item">
    						<a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>" class="service_top_link">
    							<div class="service_image"><?php the_post_thumbnail( array(120,120) ); ?></div>
                            </a>
    						<h3 class="service_title"><a href="<?php the_permalink(); ?>" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3>
                            <div class="service_excerpt"><?php the_excerpt(); ?></div>
                            <a href="<?php the_permalink(); ?>" title="Learn More" class="learn_more" role="button">Learn More</a>
                        </div><!-- .service_item -->
    				<?php endwhile;
    					// Reset Query
    					wp_reset_query();
    				?>
            </div><!-- .services_list -->

    As a side note, I’m aware that the style is all messed up. I’m only concerned with getting my query to show up properly for now.

Viewing 1 replies (of 1 total)
Viewing 1 replies (of 1 total)
  • The topic ‘get_posts only displaying link to homepage’ is closed to new replies.