Timeline for Why is the `if else` not working?
Current License: CC BY-SA 3.0
13 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Oct 16, 2012 at 19:02 | vote | accept | deathlock | ||
Oct 16, 2012 at 14:21 | comment | added | deathlock |
@MridulAggarwal Ok, I put it before the first if ... it results in a horde of lines. But I manage to understand that the posts being displayed are indeed posts that belong under the hobbynews (or its child) category. So what does this mean?
|
|
Oct 16, 2012 at 10:13 | comment | added | Mridul Aggarwal |
@deathlock I meant adding <?php global $wp_query; echo '<pre>'; var_dump($wp_query->posts); echo '</pre>';?> just before the first if. This will show on screen the post which is being checked for the category
|
|
Oct 16, 2012 at 9:59 | comment | added | deathlock | @MridulAggarwal Erm, sorry... I'm not quite a programmer, so I'm not sure what do you mean by that... In which I'm supposed to write it? | |
Oct 16, 2012 at 9:18 | comment | added | Mridul Aggarwal |
Please try doing a var_dump on the global $wp_query object, it might give you some hints
|
|
Oct 16, 2012 at 9:10 | comment | added | deathlock | @MridulAggarwal when I switch the place, what happens is the same like when I do what kovshenin told me to do. The second one's content shows up on both categories, while the first one's content does not show up. | |
Oct 16, 2012 at 9:02 | comment | added | Mridul Aggarwal | can you check switching the hobbynews & gamenews if conditions | |
Oct 16, 2012 at 8:58 | comment | added | deathlock | It is edited now | |
Oct 16, 2012 at 8:58 | history | edited | deathlock | CC BY-SA 3.0 |
added 345 characters in body
|
Oct 16, 2012 at 8:56 | comment | added | deathlock |
When I replace it with elseif (false) , it reaches the second one. Both the gamenews and hobbynews now display content meant for hobbynews. Ok, I'll edit the question.
|
|
Oct 16, 2012 at 8:28 | answer | added | Mridul Aggarwal | timeline score: 1 | |
Oct 16, 2012 at 8:26 | comment | added | kovshenin |
Try to replace your first elseif statement with elseif ( false ) ... and see if you ever reach your second one. You should also paste the code for your custom is_category_or_sub function.
|
|
Oct 16, 2012 at 8:00 | history | asked | deathlock | CC BY-SA 3.0 |