• Patrick Orr

    (@patrick-orr)


    I am using the global_post function to get posts from a specific category:

    <?php
    // The Query
    global $post;
    $args = array('numberposts' => 2, 'category'  => 14,'orderby' => 'post_date','order'  => 'DESC','post_type' => 'post','post_status' => 'publish');
    ?>
    
    <?php
    // The Loop
    $myposts = get_posts( $args );
    ?>
    <ul>
    <?php foreach( $myposts as $post ) : setup_postdata($post); ?>
    	<li>
        <div class="hp-eventthumnb"><?php the_post_thumbnail(); ?></div>
    	<div class"hp-eventdetails">
        	<h1><?php the_title(); ?></h1>
    		<p><?php substr(the_excerpt(), 0 , 250); ?></p>
    		<a href="<?php the_permalink(); ?>">Read More</a>
        </div>
        </li>
    <?php endforeach; ?>

    Only everytime it returns a bunch of unwanted links on everything:
    Testing

    If anyone can advise why this is happening and how to work around it, that would be greatly appreciated.

    I should mention I am trying to modify a purchased theme:
    Mu-types

    Thanks in advance

  • The topic ‘global $post, returns on all items’ is closed to new replies.