{"id":15607,"date":"2012-07-02T11:37:24","date_gmt":"2012-07-02T10:37:24","guid":{"rendered":"https:\/\/pl.wordpress.org\/support\/topic\/zamiana-w-menu-strony-na-kategorie\/"},"modified":"2016-08-05T21:48:42","modified_gmt":"2016-08-05T21:48:42","slug":"zamiana-w-menu-strony-na-kategorie","status":"closed","type":"topic","link":"https:\/\/pl.wordpress.org\/support\/topic\/zamiana-w-menu-strony-na-kategorie\/","title":{"rendered":"Zamiana w menu (strony na kategorie)"},"content":{"rendered":"<p>Witam, u\u017cywam sk\u00f3rki cityfinance, kt\u00f3ra w menu wy\u015bwietla istniej\u0105ce strony.<br \/>\nMi potrzebne jest wy\u015bwietlanie kategorii. <\/p>\n<p>Poni\u017cej wklejam kod odpowiedzialny za tworzenie menu<\/p>\n<pre><code>function art_menu_items($showSubmenus)\n{\n\t$GLOBALS[&#039;menu_showSubmenus&#039;] = $showSubmenus;\n\t$homeMenuItemCaption = &#039;Strona g\u0142\u00f3wna&#039;;\n\t$isHomeSelected = null;\n\tif (&#039;page&#039; == get_option(&#039;show_on_front&#039;)) {\n\t\t$pageOnFront = get_option(&#039;page_on_front&#039;);\n\t\t$pageForPosts = get_option(&#039;page_for_posts&#039;);\n\t\tif ($pageOnFront) {\n\t\t\t$page = &amp; get_post($pageOnFront);\n\t\t\tif (null != $page)\n\t\t\t\t$homeMenuItemCaption = $page-&gt;post_title;\n\t\t\t$isHomeSelected = is_page($page-&gt;ID);\n\t\t} elseif (!$pageOnFront &amp;&amp; $pageForPosts) {\n\t\t\t$page = &amp; get_post($pageForPosts);\n\t\t\tif (null != $page)\n\t\t\t\t$homeMenuItemCaption = $page-&gt;post_title;\n\t\t}\n\t}\n\tif (null === $isHomeSelected)\n\t\t$isHomeSelected = is_home();\n\n\techo &#039;&lt;li&gt;&lt;a&#039; . ($isHomeSelected ? &#039; class=&quot;active&quot;&#039; : &#039;&#039;) . &#039; href=&quot;&#039; . get_option(&#039;home&#039;) . &#039;&quot;&gt;&lt;span&gt;&lt;span&gt;&#039;\n\t\t. $homeMenuItemCaption . &#039;&lt;\/span&gt;&lt;\/span&gt;&lt;\/a&gt;&lt;\/li&gt;&#039;;\n\tadd_action(&#039;get_pages&#039;, &#039;art_header_page_list_filter&#039;);\n\tadd_action(&#039;wp_list_pages&#039;, &#039;art_list_pages_filter&#039;);\n\twp_list_pages(&#039;title_li=&#039;);\n\tremove_action(&#039;wp_list_pages&#039;, &#039;art_list_pages_filter&#039;);\n\tremove_action(&#039;get_pages&#039;, &#039;art_header_page_list_filter&#039;);\n}<\/code><\/pre>\n","protected":false},"template":"","class_list":["post-15607","topic","type-topic","status-closed","hentry","topic-tag-cityfinance","topic-tag-menu","topic-tag-strony-na-kategorie"],"jetpack_sharing_enabled":true,"_links":{"self":[{"href":"https:\/\/pl.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/15607","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/pl.wordpress.org\/support\/wp-json\/wp\/v2\/topic"}],"about":[{"href":"https:\/\/pl.wordpress.org\/support\/wp-json\/wp\/v2\/types\/topic"}],"version-history":[{"count":0,"href":"https:\/\/pl.wordpress.org\/support\/wp-json\/wp\/v2\/topic\/15607\/revisions"}],"wp:attachment":[{"href":"https:\/\/pl.wordpress.org\/support\/wp-json\/wp\/v2\/media?parent=15607"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}