I can't believe this series is 10 years old. While a lot has changed in WordPress over the years the core concepts remain the same and I hope this series is helpful in your learning journey. For anyone who is curious, my recommendation for hosting your WordPress website is DreamHost and specifically their "Shared Unlimited" yearly plan (the exact plan I've used for 19 years). If you use my link to DreamHost it helps support my TH-cam channel and costs you nothing extra: click.dreamhost.com/aff_c?offer_id=109&aff_id=17231
These old videos are real hidden gems tucked away inside the WordPress u-Tube tutorials, and they are as relevant now: as they were way back when. - And that was when our ancestors roamed the web unmolested: whilst all the while keeping an eye on their children forging way out in front dropping breadcrumbs as they walked. They were there: their path was plain to see, and it could be traced back to the beginnings, but the childless people had no breadcrumbs to follow, .. (they didn't need any.) Marvellous lesson on returning parent child functions - I've learned a great deal in that one.
You're such a big help! This is the only tutorial series that made me understand Wordpress theme development. Thank you so much for the best tutorials!
I am a new web site coder getting ready to start my first "real" WordPress project. I didn't really want to use a template but was too intimidated to make one myself. Honestly, after watching this series I've decided to go ahead and make a theme from scratch. Thanks for you videos. You do a great job of teaching; very real and practical lessons one can use immediately.
Hi David - your story is music to my ears! I'm glad you found the videos helpful, and it's great to hear you're creating a theme yourself! It may not be the "best" route for each and every WP project, but having 100% full control over the output is definitely a lifesaver for certain projects :) There should be a couple new WP videos uploaded this week, but if you have any particular requests for topics let me know - thanks!
very useful video it is but i want something different when i hover over the parent page the child pages should show in drop down list plz let me know how i do it?
Hey guys, so I was trying to follow along with the custom function code, and I'm pretty sure I followed along correctly (I double and triple checked), but I kept getting an error from WP after I refreshed my site. It's August of 2017, so who knows how many changes were made between now and when this awesome tutorial was made. Anyway long story short I had a hunch to simply add and edit some "ul ul" css styles and was able to style a drop down menu perfectly within the header navigation. I just assumed that since WordPress' menu function uses typical html elements for site navigation - nav ul li a - then targeting sub menus (I placed a few menus under another menu in the WordPress dashboard making those menus sub menus or child menus) and targeted them with typical dropdown menu site navigation - nav ul ul li a - etc. I styled them how I'd normally style site navigation and everything works just fine. Basically I didn't have to include those custom lines of code to the header.php or the functions.php. If you're an absolute beginner then a lot of this stuff will be tricky to understand. I've been studying web development for 2+ years now and PHP is super foreign to me and I got lost in this video, but if you understand a bit of CSS and basic HTML/CSS structure then you could probably try my method.
Anyone else have problem with current-page-ancestor ? It's around 15:34. Adding those 2 new lines prevents portfolio / about us / contact us where active tab getting in blue as well.
These tutorials are great! I am planning to apply what I learned to my wife's website to make it shine. One thing I am wondering is whether it is necessary to remember all those codings in CSS and the functions in wp. BTW, I am on the way to be a web developer.
You are a great teacher! I have a question, where did you learn all these wordpress functions? Did you read them from the documentation in wordpress site or did you just read the code in the wp folders? Thanks!
This is very good solution if we got more parent and children pages, but if we got only one parent page , with several children pages , maybe instead of all this code that we have in page.php template , we could make two new templates e.g. parent-page.php and child-page.php , than in functions.php ( register_nav_menus ) register two new menus , one for parent template , and one child template , of course , this is not the best solution , but maybe for beginners it would easier to implement, but like I said, this is only my opinion. BTW, great tutorial, thanks.
May I know why my code in the css for .children-links section is not working? I know I copied the text exactly but it is not translated into the website. How do I check whether the css for .children-links is directly connected to the page.php?
a rhombus yeah it's so annoying just don't know what to do! and using another browser really doesn't help if we're wanting to host a website using this coding!!!
@@kkollsga Woah!!! I almost want to quit. I look on every single letters and spaces and I see nothing wrong but still does not work, then I saw this hahaha. Thanks man!
Great series sir finding it very helpful.. well I must have screwed up somewhere in the css as my about menu header is over on the right of the child menu not on the left I will compare the downloadable lesson code I guess to see if I can find where I made my mistake. I thought I knew wordpress pretty well now I realize I didn't really know that much at all.
Monty Edwards I'm glad you're finding the series helpful! It sounds like you might still need to "clear" the "floats" from your sub-menu. You can try adding a "clearfix" class to the parent "" element, or add a declaration of "clear: both;" to the element that is not sitting where you would expect it to.
After I put following CSS -code into my stylesheet ".children-links ul { float: left; } my page title jumped next to children links, how can I organize it properly?? been struggling with it for couple of hours now..
Hi, great tutorials. Question pls! What if the top level parent page doesn't have a link, what if it's just a placeholder for a dropdown, how do I make it so that that top level menu item doesn't actually have a link to go to.
Very good tutorial!keep sharing knowledge free.I have a problem.i set my subpages in page.php and in functions.php as you mentioned and displays them properly.But why when i click on the subpage link, the main parent menu goes in a different place(upper in the header which was before) and ruins my navigation layout?Do i have to change my css?Guess not.Please help me.
Do you have a video tutorial on drop-down menus. I have followed all your videos in this series and have created my own Theme. I am using a CoursePress plug-in which uses their own pages which do not show up in the pages dashboard area, but they seem to latch onto the menu. They display in a drop-down menu format in other free themes, but not in my created Theme. Any thoughts on this would be appriciated.
This is the most difficult lesson so far. I tried to understand what was going on but it's hard with almost no experience in OOP PHP. With previous lessons it was mainly procedurar PHP but I guess wp_list_pages function has something to do with an array of objects. I am wondering if all those thrilled ppl in the comments understand what they are doing or it's just copying the code and being thrilled that it works.
I have the newer version of wordpress, and my menus have children twice on the basic menu, and also my children menu have all the pages, not only the children, how can I fix this?
Hi I woud really apreciate if you coud tell me how to make the dropdown menu a bit different. Something like instead of about us to be a page, to be a button and when you hover it to reveal 2 or 3 submenus that are pages. I tried to do that but I don t know how to create the button, I can only create a page and. Please help me
I think you make videos on how to fully create your own website, with login and blog posting features. Completely independent from Word Press. I'm a Web Developer as a hobby.
For those of you having problems getting the menu to display properly: Opera doesn't display the menu properly but Chrome and Firefox does. If you're having difficulty then try it in different browsers.
Is this still possible even with the latest version of Wordpress? I tried to follow your instructions but it did not work. Not sure if it is the Wordpress vision, my theme, or a plugin interfering.
hi! great tutorial. i am just dipping my feet into php and this really made it click in a few ways. this is working nearly perfect on my site but i am having one issue; on the pages i have set to anything but default for the template this works but any page with another template looses the menu. any chance there is a fix for this?
The child page links. I suppose this is how you make "breadcrumbs" in your page. I was wondering.. is it how one makes drop down menus. I want to turn a static page into a theme but there is a drop down menu in it. Is there another road I should be taking?
Brad Haircut That's a great question. If the drop down menu is part of your main navigation than this "child page" method is overkill. The standard "wp_nav_menu" will automatically output a nested structure of UL > LI > UL > LI to represent children / grandchildren structure etc... Then, it's just a matter of adding CSS to achieve the drop down effect. It's a bit outdated, but I have a video on "CSS Dropdown Navigation Menu." I'll try to add a more updated version and also apply it directly to our WP demo theme :)
Great tutorials! Though, I ran into some trouble that I didn't know how to fix. Even though I have Mission Statement, Our Future, and Our History children of About us, they didn't show when I refreshed the page About Us. And when I typed in within my page.php file, the list showed up under Contact Us instead of About Us. What have I done wrong?
Great stuff so far. My site denies to load while the "has_children" function is in functions.php. I have tryed copying the directly from your zip file, with the same result. Any guess, whats wrong?
If you are sure you wrote everything correctly and after refreshing your page you still don't see the css reflected on your page, do this. Press Ctr + F5. I hope this helps.
Hi, I am trying generate a page that will only show once another page has been selected from the menu. For example - I have a menu that has a few pages, one of them are call Kitchen. I want to be able to click on that tab which will show a range of kitchen items one being a page of only mugs. l do not want the mug page to be a sub page nor do I want it to be shown on the drop down list in the menu. It has to be inside the Kitchen tab. Can you help with some info?
Hi, thanks very much for the tutorial! Could you recommend a place where I could learn about the meaning of all those functions or methods like 'child_of' => ... or get_posts? is the 'developer.wordpress' reference a good place for PHP and wordpress beginner developers?
how can I use script for a different theme on wordpress, please, I need help.( I tried doing the exact same thing with a different theme, but it started doing nothing after the bullet points part.) Thank you.
in my previous question i discover this:when i put in my page.php the if is_page(131) to giv a specific text decription to the page in the header and when i click to the subpages links the main parent menu goes in a different place(upper in the header which was before).How could it be?this same problem occured and in the page-contact.php which has also one subpage.any help appreciated!!
I have the child pages displaying like the top level nav items just below the main about nav item. on the child pages i have the ul list unstyled with the title. How do i get rid of the other links in the primary nave area? using WP 4.4.2. Your help is appreciated
+Anthony Giello SOLVED! I created the pages with the "special page" template, when I switched back to the default template and transferred the code to page.php the "sub-nav" worked.
Hi, because I'm a beginner and I appreciate your work I would like to add some solution I found while yours wasn't working in my template. the function has_children(); wasn't given the result I expected so I just wrote this one. function has_children(){ global $post; $args = array( 'post_parent' => $post->ID, 'post_type' => 'any', 'numberposts' => -1, 'post_status' => 'any' ); $pages = get_children( $args); //$pages = get_children('child_of =' . $post->ID); return count($pages); } I hope it's useful and help people struggling like me to learning this wonderful tool.
Though the solution in the video is ``` $pages = get_pages('child_of=' . $post->ID); ``` instead of ``` $pages = get_children('child_of =' . $post->ID); ```
Superb tutorial !! Thanks a lot !! The get_top_ancestor_id() function could be simplified as follows: function get_top_ancestor_id() { global $post; if($post->post_parent !== 0) { return $post->post_parent; } else { return $post->ID; } }
i tried without using array_reverse() function and it works same. so my question is why you used array_reverse() function ? code is on 7.37 time in this video
I have a huge problem and I can't figure it out: The child links are being displayed all the time, not just when the parent link is selected. Also, in the css file, this whole block of code is not allowing the current menu Item or page ancestor to stay lit up when selected: .site-header nav ul li.current-menu-item a:link, .site-header nav ul li.current-menu-item a:visited, .site-header nav ul li.current-page-ancestor a:link, .site-header nav ul li.current-page-ancestor a:visited I even copied and pasted the source code accompanied with this lesson directly into notepad++ with no luck. I am using Wordpress 4.4.2. Any suggestions?
"Meat and potatoes" (5:15) wow, nice expression. Can't recall if I have heard it before lol. I suppose the British proverb would be "bangers and mash" ha ha
can anyone know how we make rules in .htaccess file to bound rules of our website and secure it. Any resources have plz let me know. The wordpress tutorials are very good. I learn lots of new techniques. Thanks for making it.
Thanks for the so elaborated video. Everything is working fine except one code get_top_ancestor_id(), //Get Top Ancestor function get_top_ancestor_id() { if ($post->post_parent) { $ancestors= array_reverse(get_top_ancestors($post->ID)); return $ancestors [0]; } return $post->ID;
} Can you please explain?. I follow your tutorial from start. I tried so many time but this code is not working for me on chrome. please suggest
I can't believe this series is 10 years old. While a lot has changed in WordPress over the years the core concepts remain the same and I hope this series is helpful in your learning journey. For anyone who is curious, my recommendation for hosting your WordPress website is DreamHost and specifically their "Shared Unlimited" yearly plan (the exact plan I've used for 19 years). If you use my link to DreamHost it helps support my TH-cam channel and costs you nothing extra: click.dreamhost.com/aff_c?offer_id=109&aff_id=17231
These old videos are real hidden gems tucked away inside the WordPress u-Tube tutorials, and they are as relevant now: as they were way back when.
- And that was when our ancestors roamed the web unmolested: whilst all the while keeping an eye on their children forging way out in front dropping breadcrumbs as they walked.
They were there: their path was plain to see, and it could be traced back to the beginnings, but the childless people had no breadcrumbs to follow, .. (they didn't need any.)
Marvellous lesson on returning parent child functions - I've learned a great deal in that one.
you should get the "hero of the year " award!! This kind of charitable work can only done by a good human being!! Thank You
This is the easiest tutorial I have stumbled on so far.
It is so clear and explicit.
Thank you very much, it really helped me.
You're such a big help! This is the only tutorial series that made me understand Wordpress theme development. Thank you so much for the best tutorials!
Absolutely brilliant tutorial!! Excellent teacher!! The entire course on here is Fantastic!
You are one of the best teacher there are online. Thank you for a great content.
Your tutorials are the best! Clear, concise, and inordinately helpful. Thank you.
Thanks for your videos. You have shown me that Wordpress is definitely the way forward for me and my site and shown me just how useful this can be!
I am a new web site coder getting ready to start my first "real" WordPress project. I didn't really want to use a template but was too intimidated to make one myself. Honestly, after watching this series I've decided to go ahead and make a theme from scratch. Thanks for you videos. You do a great job of teaching; very real and practical lessons one can use immediately.
Hi David - your story is music to my ears! I'm glad you found the videos helpful, and it's great to hear you're creating a theme yourself! It may not be the "best" route for each and every WP project, but having 100% full control over the output is definitely a lifesaver for certain projects :) There should be a couple new WP videos uploaded this week, but if you have any particular requests for topics let me know - thanks!
David Haisten f
excellent video - you're an amazing instructor that makes PHP seem so natural and less overwhelming
With watching few of your videos i got very good insights into wordpress. Thanks for sharing your knowledge! Brad, you simply rock!
Yet another great tutorial! Thanks a lot. Superb voice, microphone and explanation.
Unbelievably good teacher, this course is just fantastic all around
This was such a big help and a life saver. I've been looking for hours and most other examples were way over complicated. Many thanks!!
very useful video it is but i want something different
when i hover over the parent page the child pages should show in drop down list plz let me know how i do it?
Brilliant teaching skills. Wish you best of luck bro....
The best tutorial ever..massive respect sir....
Than you for a great introduction! better than other I paid for!
Thank you so much man for sharing your knowledge to us. Not skipping some ads to pay you somehow.
Hey guys, so I was trying to follow along with the custom function code, and I'm pretty sure I followed along correctly (I double and triple checked), but I kept getting an error from WP after I refreshed my site.
It's August of 2017, so who knows how many changes were made between now and when this awesome tutorial was made. Anyway long story short I had a hunch to simply add and edit some "ul ul" css styles and was able to style a drop down menu perfectly within the header navigation.
I just assumed that since WordPress' menu function uses typical html elements for site navigation - nav ul li a - then targeting sub menus (I placed a few menus under another menu in the WordPress dashboard making those menus sub menus or child menus) and targeted them with typical dropdown menu site navigation - nav ul ul li a - etc. I styled them how I'd normally style site navigation and everything works just fine. Basically I didn't have to include those custom lines of code to the header.php or the functions.php.
If you're an absolute beginner then a lot of this stuff will be tricky to understand. I've been studying web development for 2+ years now and PHP is super foreign to me and I got lost in this video, but if you understand a bit of CSS and basic HTML/CSS structure then you could probably try my method.
Anyone else have problem with current-page-ancestor ? It's around 15:34. Adding those 2 new lines prevents portfolio / about us / contact us where active tab getting in blue as well.
All Thumbs up & Thank you for all the wordpress Customization Series
These tutorials are great! I am planning to apply what I learned to my wife's website to make it shine. One thing I am wondering is whether it is necessary to remember all those codings in CSS and the functions in wp. BTW, I am on the way to be a web developer.
For anyone wondering, $post is an in-built variable provided by wordpress. We haven't declared it anywhere, it just comes out of the box
okey thanks. there seem to be alot of those and functions that you got to remember. Quite hard to keep track of all declared things : /
Really good tutorial, straight to the point.
How do you get to (or in) the where you can change the different lines in the html. that is marked 2:18 in this video.
Anybody know what text-editor he is using?
he used TextMate in this video, but said he'd recommend Atom or SublimeText now.
You are a great teacher!
I have a question, where did you learn all these wordpress functions?
Did you read them from the documentation in wordpress site or did you just read the code in the wp folders?
Thanks!
Which HTML editor are you using? I've been using CoffeeCup, but the program you're using looks a lot more intuitive.
Thanks for all your great tutorials, extremely helpful!
This is very good solution if we got more parent and children pages, but if we got only one parent page , with several children pages , maybe instead of all this code that we have in page.php template , we could make two new templates e.g. parent-page.php and child-page.php , than in functions.php ( register_nav_menus ) register two new menus , one for parent template , and one child template ,
of course , this is not the best solution , but maybe for beginners it would easier to implement, but like I said, this is only my opinion.
BTW, great tutorial, thanks.
May I know why my code in the css for .children-links section is not working? I know I copied the text exactly but it is not translated into the website. How do I check whether the css for .children-links is directly connected to the page.php?
i think is not compatible to your browser, in google chrome its not working when i try to mozilla its working
a rhombus yeah it's so annoying just don't know what to do!
and using another browser really doesn't help if we're wanting to host a website using this coding!!!
If the webpage isn't updating in chrome after changes in the .css you might just need to clear the cache. You do that by refreshing the page with +
@@kkollsga Woah!!! I almost want to quit. I look on every single letters and spaces and I see nothing wrong but still does not work, then I saw this hahaha. Thanks man!
Thank so much for your very informative video. Simply very good!
Great tutorial thanks a lot. Could you please tell me where I find the description to check your code I don't seem to be able to find it anywhere.
Very elegant solution!! Thx for sharing it!
7:17 I refactored getting the last element because it looked a bit more readable
$ancestors = get_post_ancestors( $post->ID );
return end($ancestors);
Great series sir finding it very helpful.. well I must have screwed up somewhere in the css as my about menu header is over on the right of the child menu not on the left I will compare the downloadable lesson code I guess to see if I can find where I made my mistake. I thought I knew wordpress pretty well now I realize I didn't really know that much at all.
Monty Edwards I'm glad you're finding the series helpful! It sounds like you might still need to "clear" the "floats" from your sub-menu. You can try adding a "clearfix" class to the parent "" element, or add a declaration of "clear: both;" to the element that is not sitting where you would expect it to.
LearnWebCode Monty Edwards - Did this work for you?
***** Found the fail, sorry my mistake.
Thanks for the tutorial it was really helpful!
Anyway you can show how to add the home page to this navigation menu?
After I put following CSS -code into my stylesheet
".children-links ul {
float: left;
}
my page title jumped next to children links, how can I organize it properly?? been struggling with it for couple of hours now..
+Bart Heimenberg But why is he floating the ul and nothing bad happens?
+David Kentala I'm having the same problem. Did you find a solution?
put this after ul
fix the name of the class parent-link on page.php file. it should be parent-link, and NOT parent_link
Hi, great tutorials. Question pls! What if the top level parent page doesn't have a link, what if it's just a placeholder for a dropdown, how do I make it so that that top level menu item doesn't actually have a link to go to.
really brilliant sir, you are excellent
Very good tutorial!keep sharing knowledge free.I have a problem.i set my subpages in page.php and in functions.php as you mentioned and displays them properly.But why when i click on the subpage link, the main parent menu goes in a different place(upper in the header which was before) and ruins my navigation layout?Do i have to change my css?Guess not.Please help me.
Awesome tutorials ;).
What program are you using as the "notepad" for writing the code?
Do you have a video tutorial on drop-down menus. I have followed all your videos in this series and have created my own Theme. I am using a CoursePress plug-in which uses their own pages which do not show up in the pages dashboard area, but they seem to latch onto the menu. They display in a drop-down menu format in other free themes, but not in my created Theme. Any thoughts on this would be appriciated.
Very good and solid video tutorial. Really Excellent. I like it. Thanks for sharing great video.
Very nice series and very well explained.. Thank you very much :)
This is the most difficult lesson so far. I tried to understand what was going on but it's hard with almost no experience in OOP PHP. With previous lessons it was mainly procedurar PHP but I guess wp_list_pages function has something to do with an array of objects. I am wondering if all those thrilled ppl in the comments understand what they are doing or it's just copying the code and being thrilled that it works.
I have the newer version of wordpress, and my menus have children twice on the basic menu, and also my children menu have all the pages, not only the children, how can I fix this?
Is the repeated video as the previous? anyway thank for the tutorial.
This doesn't seem to work with newer versions of WordPress :/
I just have maybe a newbie question but, this does actually "works" as a dropdown menu?, since I'm trying to create one I'm wondering if this helps.
Hi I woud really apreciate if you coud tell me how to make the dropdown menu a bit different. Something like instead of about us to be a page, to be a button and when you hover it to reveal 2 or 3 submenus that are pages. I tried to do that but I don t know how to create the button, I can only create a page and. Please help me
Goodness me this video helped me out today. Thanks so much for sharing!
I think you make videos on how to fully create your own website, with login and blog posting features. Completely independent from Word Press. I'm a Web Developer as a hobby.
hi,
How would i get the granchildren only of a parent page using a wp_Query? I can't seem to figure this one out. Thanks and great tutorials
For those of you having problems getting the menu to display properly: Opera doesn't display the menu properly but Chrome and Firefox does. If you're having difficulty then try it in different browsers.
Is this still possible even with the latest version of Wordpress? I tried to follow your instructions but it did not work. Not sure if it is the Wordpress vision, my theme, or a plugin interfering.
Very good tutorials! Good job! and thank you
hi! great tutorial. i am just dipping my feet into php and this really made it click in a few ways. this is working nearly perfect on my site but i am having one issue; on the pages i have set to anything but default for the template this works but any page with another template looses the menu. any chance there is a fix for this?
hi! i meant to say that on any page set to 'default' template it works fine but any other it does not. sorry about that and thanks again!
The child page links. I suppose this is how you make "breadcrumbs" in your page. I was wondering.. is it how one makes drop down menus. I want to turn a static page into a theme but there is a drop down menu in it. Is there another road I should be taking?
Brad Haircut That's a great question. If the drop down menu is part of your main navigation than this "child page" method is overkill. The standard "wp_nav_menu" will automatically output a nested structure of UL > LI > UL > LI to represent children / grandchildren structure etc... Then, it's just a matter of adding CSS to achieve the drop down effect. It's a bit outdated, but I have a video on "CSS Dropdown Navigation Menu." I'll try to add a more updated version and also apply it directly to our WP demo theme :)
You are very awesome!! Tnx for making this great video tutorial!!
Great tutorials!
Though, I ran into some trouble that I didn't know how to fix.
Even though I have Mission Statement, Our Future, and Our History children of About us, they didn't show when I refreshed the page About Us. And when I typed in within my page.php file, the list showed up under Contact Us instead of About Us.
What have I done wrong?
hi your videos are really good and very helpful .
can you also tell me how to take input from user and apply mathamatical function to it...?
Great stuff so far.
My site denies to load while the "has_children" function is in functions.php.
I have tryed copying the directly from your zip file, with the same result.
Any guess, whats wrong?
very nice tutorial, thx and god bless you and the world... regards from hong kong ^_^
my children-link class is not being applied what should do i am following the code ?
If you are sure you wrote everything correctly and after refreshing your page you still don't see the css reflected on your page, do this. Press Ctr + F5. I hope this helps.
Is there a way to display the subpages with Ajax?
when i click on the child page, my child nav is not seen on they child page, and my code is copy of your code ! so what is they problems ?
Hi, I am trying generate a page that will only show once another page has been selected from the menu. For example - I have a menu that has a few pages, one of them are call Kitchen. I want to be able to click on that tab which will show a range of kitchen items one being a page of only mugs. l do not want the mug page to be a sub page nor do I want it to be shown on the drop down list in the menu. It has to be inside the Kitchen tab. Can you help with some info?
Hi, thanks very much for the tutorial!
Could you recommend a place where I could learn about the meaning of all those functions or methods like 'child_of' => ... or get_posts?
is the 'developer.wordpress' reference a good place for PHP and wordpress beginner developers?
codex.wordpress.org/Function_Reference
Hi,
Can we make category as child of parent page? I mean is it possible to make wp_list_categories() child of a particular page?
Great Video series . Very nice !
those who got problem in functions
index.php
thank you man!
thanks a lot, problem is you cannot follow along with that code, since you need the function for the next step.
Thank you for the tips. You really saved me time. I was cracking my brain going through every line. Do you have channel?
i love you
how can I use script for a different theme on wordpress, please, I need help.( I tried doing the exact same thing with a different theme, but it started doing nothing after the bullet points part.) Thank you.
you are a life saver
in my case get_ancestor function did not work and created a loop of functions 7:30
I am using 4.9.4
in my previous question i discover this:when i put in my page.php the if is_page(131) to giv a specific text decription to the page in the header and when i click to the subpages links the main parent menu goes in a different place(upper in the header which was before).How could it be?this same problem occured and in the page-contact.php which has also one subpage.any help appreciated!!
Any change wordpress has a way of posing the year a Post was made? like
or something?
Yep! Try ""
which is the best editor
I have the child pages displaying like the top level nav items just below the main about nav item. on the child pages i have the ul list unstyled with the title. How do i get rid of the other links in the primary nave area? using WP 4.4.2. Your help is appreciated
+Anthony Giello SOLVED! I created the pages with the "special page" template, when I switched back to the default template and transferred the code to page.php the "sub-nav" worked.
Hi, because I'm a beginner and I appreciate your work I would like to add some solution I found while yours wasn't working in my template.
the function has_children(); wasn't given the result I expected so I just wrote this one.
function has_children(){
global $post;
$args = array(
'post_parent' => $post->ID,
'post_type' => 'any',
'numberposts' => -1,
'post_status' => 'any'
);
$pages = get_children( $args);
//$pages = get_children('child_of =' . $post->ID);
return count($pages);
}
I hope it's useful and help people struggling like me to learning this wonderful tool.
Thanks a lot!
Though the solution in the video is
```
$pages = get_pages('child_of=' . $post->ID);
```
instead of
```
$pages = get_children('child_of =' . $post->ID);
```
See codex.wordpress.org/Function_Reference/get_pages
hey brother... i want to get IDs of only child pages not the grandchild page's id .......what should i do?.......pls help ....
Superb tutorial !! Thanks a lot !!
The get_top_ancestor_id() function could be simplified as follows:
function get_top_ancestor_id() {
global $post;
if($post->post_parent !== 0) {
return $post->post_parent;
} else {
return $post->ID;
}
}
BRILLIANT!
I like how the view drastically drop down as each video gets more complex.
Please Help me.I can not found Template optaion in my wordpress.Parent and order then come template but i don't found template option
I keep getting an error with the final step of the video where the if function is written. Now my about tab has an error. Can any help me out?
i tried without using array_reverse() function and it works same. so my question is why you used array_reverse() function ?
code is on 7.37 time in this video
I have a huge problem and I can't figure it out: The child links are being displayed all the time, not just when the parent link is selected. Also, in the css file, this whole block of code is not allowing the current menu Item or page ancestor to stay lit up when selected:
.site-header nav ul li.current-menu-item a:link,
.site-header nav ul li.current-menu-item a:visited,
.site-header nav ul li.current-page-ancestor a:link,
.site-header nav ul li.current-page-ancestor a:visited
I even copied and pasted the source code accompanied with this lesson directly into notepad++ with no luck. I am using Wordpress 4.4.2. Any suggestions?
How to get the submenus in drop down instead of appearing below
how do you display the content when you click a link
I cant get the function to work, any chance there could be something that is clashing with it?
Very nice video Brother..
Can we do the same thing with Categories Parent and Sub Pages... Please guide...
"Meat and potatoes" (5:15) wow, nice expression. Can't recall if I have heard it before lol. I suppose the British proverb would be "bangers and mash" ha ha
after adding all finctions .....on children pages all pages list is displaying as it was displaying on parent page when we added wp_list_pages..
how would i create a drop down menu for the nav? :)
can anyone know how we make rules in .htaccess file to bound rules of our website and secure it. Any resources have plz let me know. The wordpress tutorials are very good. I learn lots of new techniques. Thanks for making it.
Thanks for the so elaborated video. Everything is working fine except one code
get_top_ancestor_id(),
//Get Top Ancestor
function get_top_ancestor_id() {
if ($post->post_parent) {
$ancestors= array_reverse(get_top_ancestors($post->ID));
return $ancestors [0];
}
return $post->ID;
}
Can you please explain?. I follow your tutorial from start. I tried so many time but this code is not working for me on chrome. please suggest
Why does this line, "" have 3 classes all controlling the same code? Why not just use one class?