Note that there are some explanatory texts on larger screens.

plurals
  1. POWordpress getChildren using to make an menu
    primarykey
    data
    text
    <p>My problem is: i Want to make my own Menubar that looks like this: <img src="https://i.stack.imgur.com/ZNo0W.png" alt="enter image description here"></p> <p>As you can see the buttons on the top are FIXED (these are the 6 Parents in which the Pages can get)</p> <p>If you press on the green button the submenuitems appear. Now - if you press on the submenuitem the submenu should appear under the specific submenuitem. In html it's easy:</p> <p>But now I need the subsubitem of the pages via php in this "format".</p> <pre><code>&lt;div class="menuitem" id="info"&gt; &lt;a href="#"&gt;&lt;img src="./information.jpg" height="120" width="*"&gt;&lt;/img&gt;&lt;/a&gt;&lt;/div&gt; &lt;div id="infosub"&gt; &lt;div onClick="hoverSubMenu('infosub1')" class="submenu"&gt;submenuitem1&lt;/div&gt; &lt;div id="infosub1" class="subsubmenu"&gt; &lt;div class="subsubitem"&gt;test1.1&lt;/div&gt; &lt;div class="subsubitem"&gt;test1.2&lt;/div&gt; &lt;div class="subsubitem"&gt;test1.3&lt;/div&gt; &lt;div class="subsubitem"&gt;test1.4&lt;/div&gt; &lt;div class="subsubitem"&gt;test1.5&lt;/div&gt; &lt;/div&gt; &lt;div onClick="hoverSubMenu('infosub2')" class="submenu"&gt;submenuitem2&lt;/div&gt; &lt;div id="infosub2" class="subsubmenu"&gt; &lt;div class="subsubitem"&gt;test2.1&lt;/div&gt; &lt;/div&gt; &lt;div onClick="hoverSubMenu('infosub3')" class="submenu"&gt;submenuitem3&lt;/div&gt; &lt;div id="infosub3" class="subsubmenu"&gt; &lt;/div&gt; &lt;/div&gt; </code></pre> <p>Anyone knows what I trying?</p> <p>(getting the things opened and closed are no problems - the problem is only how can I get the subpages of a specific page and then also the subpages of THIS subpage and then getting it into this format)</p> <p>I tried it myself like this:</p> <pre><code>&lt;?php // Set up the objects needed $my_wp_query = new WP_Query(); $all_wp_pages = $my_wp_query-&gt;query(array('post_type' =&gt; 'page')); // Get the page as an Object $information = get_page_by_title('Information'); // Filter through all pages and find Information's children $information_children = get_page_children( $information-&gt;ID, $all_wp_pages ); // echo what we get back from WP to the browser echo '&lt;div onClick="hoverSubMenu("infosub1")" class="submenu"&gt;' . print_r( $information_children, true ) . '&lt;/div&gt;'; echo '&lt;div id="infosub1" class="subsubmenu"&gt;'; echo '&lt;div class="subsubitem"&gt;' ... </code></pre> <p>But there is the problem that it will show EVERY submenuitem and then show EVERY subsubmenuitem - not like in the html 1.submenuitem 1.1 subsubitem 1.2. subsubitem then 2. submenuitem 2.1. submenuitem...</p>
    singulars
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    plurals
    1. This table or related slice is empty.
    1. This table or related slice is empty.
    1. This table or related slice is empty.
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload