{"id":121,"date":"2006-10-19T22:10:58","date_gmt":"2006-10-20T03:10:58","guid":{"rendered":"http:\/\/www.graphics-muse.org\/wp\/?p=121"},"modified":"2006-10-19T22:10:58","modified_gmt":"2006-10-20T03:10:58","slug":"wordpress-hack-disabling-showing-page-children","status":"publish","type":"post","link":"https:\/\/www.graphics-muse.org\/wp\/?p=121","title":{"rendered":"WordPress hack:  disabling showing page children"},"content":{"rendered":"<p>I was working on my Dept 56 pages when I discovered that all child pages of a top level page would be displayed in the sidebar.&nbsp; I don&#39;t really want that.&nbsp; I want child pages to be linked from the top level page only.&nbsp; That way the hierarchy isn&#39;t stuffed into the sidebar making it way larger than it should be. &nbsp;<\/p>\n<p>I dug around a little in the WP code and found that the function _page_level_out() in wp-includes\/template-functions-post.php has a bit of code that looks like this:<\/p>\n<p><strong><font color=\"#006600\"> if ( isset($cur_page[&#39;children&#39;]) &amp;&amp; is_array($cur_page[&#39;children&#39;]) ) {<br \/> &nbsp;&nbsp; $new_depth = $depth + 1;<\/p>\n<p> &nbsp;&nbsp; if ( !$args[&#39;depth&#39;] || $depth &lt; ($args[&#39;depth&#39;]-1) ) {<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $output .= &quot;$indent&lt;ul&gt;\\n&quot;;<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $output .= _page_level_out($page_id, $page_tree, $args, $new_depth, false);<br \/> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp; $output .= &quot;$indent&lt;\/ul&gt;\\n&quot;;<br \/> &nbsp;&nbsp; }<br \/> }<\/font><\/strong><\/p>\n<p><strong><font color=\"#006600\"><br \/> <\/font><\/strong>If I comment this out, the children don&#39;t show up in the sidebar.&nbsp; Very cool.&nbsp; It&#39;s a hack and there really ought to be a programmable (re: argument based call) that can disable this, but I just needed it turned off for now.&nbsp; And no, I haven&#39;t dug through the addons for WP to see if anyone has written a plugin for this functionality.&nbsp; I don&#39;t know how the plugin architecture works (haven&#39;t dug into that &#8211; too many other things to do) so I&#39;m not sure how it might be implemented.&nbsp; For my purposes, this hack works fine.&nbsp;<\/p>\n<p> <strong><font color=\"#006600\"><\/font><\/strong><\/p>\n","protected":false},"excerpt":{"rendered":"<p>I was working on my Dept 56 pages when I discovered that all child pages of a top level page would be displayed in the sidebar.&nbsp; I don&#39;t really want that.&nbsp; I want child pages to be linked from the top level page only.&nbsp; That way the hierarchy isn&#39;t stuffed into the sidebar making it [&hellip;]<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"closed","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"ngg_post_thumbnail":0,"jetpack_post_was_ever_published":false,"footnotes":"","jetpack_publicize_message":"","jetpack_publicize_feature_enabled":true,"jetpack_social_post_already_shared":false,"jetpack_social_options":{"image_generator_settings":{"template":"highway","enabled":false},"version":2}},"categories":[26],"tags":[636,629],"class_list":{"0":"post-121","1":"post","2":"type-post","3":"status-publish","4":"format-standard","6":"category-wordpress","7":"tag-dept-56","8":"tag-wordpress","9":"czr-hentry"},"jetpack_publicize_connections":[],"aioseo_notices":[],"jetpack_featured_media_url":"","jetpack_shortlink":"https:\/\/wp.me\/pe9t8-1X","jetpack_sharing_enabled":true,"jetpack-related-posts":[],"jetpack_likes_enabled":true,"_links":{"self":[{"href":"https:\/\/www.graphics-muse.org\/wp\/index.php?rest_route=\/wp\/v2\/posts\/121","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.graphics-muse.org\/wp\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.graphics-muse.org\/wp\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.graphics-muse.org\/wp\/index.php?rest_route=\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.graphics-muse.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=121"}],"version-history":[{"count":0,"href":"https:\/\/www.graphics-muse.org\/wp\/index.php?rest_route=\/wp\/v2\/posts\/121\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.graphics-muse.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=121"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.graphics-muse.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=121"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.graphics-muse.org\/wp\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=121"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}