Bug report: frontend.php:318

This topic contains 3 reply and 2 voices, and was last updated by towhid 8 years, 9 months ago
Viewing 3 Posts - 1 through 3 (of 3 total)
Author Posts
June 24, 2015 at 7:37 am 52910
towhid Hello, There is a bug in the loop. The $projects variable is an Array with WP_Post Objects listed by numerical indexes, but the last item of the Array is a key=>value item: [total_projects] => N On the front-end, the output generate a last "project" that is in fact a link to the current page. I suggest checking if current item of the loop is A) an object and B) is a WP_Post object. Else continue. `if ( !$project_obj->has_permission( $project ) || !is_object( $project ) || !is_a( $project, 'WP_Post' ) ) { continue; }` Please advise. Thank you
June 30, 2015 at 4:09 pm 53768
towhid towhid

Hello Charles,

Sorry for my late reply. I am really sorry to say that I did not understand your question. Can you please clear the question more.

Thanks

June 30, 2015 at 5:33 pm 53782
Charles Charles

Hello again,

I am not asking a question. I am stating that there is error in you code, I am explaining to you what it is, and I am giving you a way to repair it. I am a senior WordPress developper.

File: frontend.php, near line 318

The $projects variable is an Array with WP_Post Objects listed by numerical indexes, but the last item of the Array is a key=>value item: [total_projects] => N

RESULT: On the front-end, the output generate a last “project” that is in fact a link to the current page.

You need either to check in the loop if the current item is a WP_Post Object or rebuild the output of the CPM_Project->get_projects to store all the WP_Post Objects inside a single sub array.

July 1, 2015 at 3:11 pm 53902
towhid towhid

Hello Charles,

Thank you very much for pointing out the code error to us. I will discuss to our developer team about the error. 🙂

Viewing 3 Posts - 1 through 3 (of 3 total)