Site icon Hip-Hop Website Design and Development

Customized submit sort loop error: Attempting to get property of non-object

A plugin I’m utilizing creates a customized submit sort for articles ie. ‘ht_kb’.

In my themes entrance web page I’ve a customized loop displaying current posts of the usual ‘submit’ sort. On the identical entrance web page I’ve one other customized loop displaying current posts of the plugins customized ‘ht_kb’ submit sort. The usual submit sort loop works as anticipated, however with the customized submit sort loop I get the error as posted beneath.

I’m having issue understanding the explanation for this error and would actually respect if somebody may clarify what i’m doing incorrect and what’s the right approach of looping by means of a customized submit sort.

The loop beneath works simply superb with the usual ‘submit’ sort.

//The Question
$post_args = array(
'post_type' => array('submit'),
'posts_per_page' => 4
);

$post_query = new WP_Query($post_args);

// The Loop
if ($post_query->have_posts()) {

whereas ($post_query->have_posts()) {

    $post_query->the_post();
    the_title();
    the_category();
    the_date();
    the_author();
    the_excerpt();
}

//reset loop

wp_reset_postdata();

}

?>

The customized submit sort loop beneath returns the error:

Discover: Attempting to get property of non-object in C:localhostmywebsitewp->includestemplate.php on line 679

Discover: Attempting to get property of non-object in C:localhostmywebsitewp->includestemplate.php on line 679

Loop for the customized submit sort

<?php

// The Question
$article_args = array(
'post_type' => array('ht_kb'),
'posts_per_page' => 4
);

$article_query = new WP_Query($article_args);

// The Loop
if ($article_query->have_posts()) {

whereas ($article_query->have_posts()) {

    $article_query->the_post();
    the_title();
    the_category();
    the_date();
    the_author();
    the_excerpt();
}

//reset loop

wp_reset_postdata();
}
?>

notice: If I remark out the_excerpt(); perform, The loop doesn’t show the error and (kind of) works as meant though different points comparable to, the_category() perform doesn’t return any worth.

Thanking you on your time and assist.