Timeline for is_child() function
Current License: CC BY-SA 3.0
17 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Nov 17, 2017 at 9:34 | comment | added | Valentin | ok @Shibi. I know I need the parent ID and that was the good ID. That's why I don't understand what you mean. The echo are just written to test. | |
Nov 16, 2017 at 9:26 | comment | added | Shibi | @Valentin dude you know the comment is before you answered just see the times... and the purpose was to tell you that you code is fine just need a little modification. | |
Nov 16, 2017 at 8:34 | comment | added | Valentin | @Shibi we have an answer and a working solution. I don't understand the purpose of your comment. | |
Nov 14, 2017 at 16:24 | vote | accept | Valentin | ||
Nov 14, 2017 at 16:22 | answer | added | Valentin | timeline score: 1 | |
Nov 14, 2017 at 16:16 | answer | added | Nathan Johnson | timeline score: 4 | |
Nov 14, 2017 at 16:13 | comment | added | Shibi |
you need to remove the echo in the function and the function is_child($parentID) need the parent id
|
|
Nov 14, 2017 at 15:55 | comment | added | Valentin | Thanks but it's pages... for sure ! And I answered you that it doesn't work even without is_page(). I think @jacob-peattie has a track but I don't know how to handle it. | |
Nov 14, 2017 at 15:47 | comment | added | prosti | Are you sure you are working with pages? Maybe you used posts developer.wordpress.org/reference/functions/is_single | |
Nov 14, 2017 at 15:40 | history | edited | Valentin | CC BY-SA 3.0 |
details
|
Nov 14, 2017 at 15:34 | comment | added | Valentin | @prosti parameter for is_page is optional. Even without it, this code doesn't work. | |
Nov 14, 2017 at 15:09 | comment | added | prosti | Please make a note your is_page function has no parameter in it. developer.wordpress.org/reference/functions/is_page | |
Nov 14, 2017 at 15:06 | history | edited | Valentin | CC BY-SA 3.0 |
testing code
|
Nov 14, 2017 at 15:01 | comment | added | Valentin | I've written it in my functions.php. So it's called on every page and for my testing purpose I check it on a child page with the ID of its parent. With a simple echo in an if statement. The function is well played and I can echo the parent's ID in it. | |
Nov 14, 2017 at 14:50 | comment | added | Jacob Peattie | You’re using the global $post variable, which means the result will depend highly on where exactly it’s used. Where is the function being used? | |
Nov 14, 2017 at 14:50 | history | edited | Valentin | CC BY-SA 3.0 |
include tests I've done
|
Nov 14, 2017 at 14:35 | history | asked | Valentin | CC BY-SA 3.0 |