{"id":125504,"date":"2011-10-11T08:00:00","date_gmt":"2011-10-11T08:00:00","guid":{"rendered":"https:\/\/www.weixiaoduo.com\/plugins\/2024\/02\/22\/pagenamed-menu-classes\/"},"modified":"2011-11-09T05:50:00","modified_gmt":"2011-11-09T05:50:00","slug":"pagenamed-menu-classes","status":"publish","type":"post","link":"https:\/\/www.weixiaoduo.com\/plugins\/pagenamed-menu-classes\/","title":{"rendered":"PageNamed Menu Classes"},"content":{"rendered":"<p>If you know what a Style Sheet is and know that SEO rules, then you should know that the safest way to iconize a menu item or style each page\/post list items with a different image\/graphic\/icon is by its slug, since it\u2019s the only thing that you will ALWAYS keep the same, or search engines would lose your page\u2019s index and value.<\/p>\n<h4>Some tips to save you the time with your theme development:<\/h4>\n<ul>\n<li>This can not be achieved with WP provided template tags.<\/li>\n<li>Menu item ID# won\u2019t get you the actual post ID#<\/li>\n<li>Menu item title is EMPTY at least you name it differently by hand.<\/li>\n<li>Page\/Post ID could change by moving, re-importing and other content handling, breaking your style sheet.<\/li>\n<li>Class names are possible since WP 2.9 but they need to be added MANUALLY, and?<\/li>\n<li>?menus need to be activated and theme changed for them to work.<\/li>\n<li>A new blog won\u2019t take those menu classes from your theme.<\/li>\n<\/ul>\n<p>There\u2019s a limitation on current wordpess version that removes post-title and post-name from menu-items in database, to prevent them to be confused with the actual page. Yes, they are stored in the same table, and until all the functions are revised to be safe not to confuse nav-menu-items with posts or pages, you can\u2019t get the name nor title nor url! Not with single wp template tags.<\/p>\n<p>Although WP considers the ID of the post as the more safe and CONSTANT piece of data you can use to refer your article as, but that\u2019s inside your WP installation, not extensible to the real world. The post or menu ID could change due to several factors like backing up your site, moving domain, replacing page, new menu items created, etc., but there\u2019s something you will NEVER allow to change: the PERMALINK.<\/p>\n<p>Consequences of changing the url of your post are so severe, that our best clients are those who let their website in hands some hacky guy who promised?miraculous rankings on search engines and they lost 50% of value (for a company depending on 2M internet sales).<\/p>\n<p>Post and Menu IDs could change, breaking the link with your Style Seet rules, and losing your custom logos.<\/p>\n<p>You might want to rather pay extra your developer to keep permalinks the same, than IDs.<\/p>\n<p>So now the most SAFE and CONSTANT piece of data, for you, is the permalink, not the ID. You should do ANYTHING to get it done this way, regardless of what your programmer says is safer. He works for your Google rank, not for WordPress, so listen to me, not them.<\/p>\n<p>After banging my head for days trying to get a solution for this, I realized nobody does it because WordPress doesn\u2019t provide the data (yet).<\/p>\n<p>If you are a WP guru, or a coder monkey like me, check the article about this plugin\u2019s release for the code what will allow you to hack that wp class that can\u2019t get the title:<\/p>\n<p>If you wouldn\u2019t hack your .php files, here\u2019s a ready-to-use plugin, soon to appear in WordPress pages.<\/p>\n<p>It\u2019s very simple, but it adds your page \/ post\u2019s slug ( sanitized-name-of-your-page ?or ?your-manually-entered-permalink ) to the class of the li that contains it. It also takes a little bit until your SEO defines the right permalink for your posts and you will still have to re-adjust the Style Sheet after his changes (until next release when this plugin will keep track of changes) but once the permalink is defined (they should be defined before making the post live, anyway) your icon \/ style will remain together with your menu item, regardless of the above scenarios where your post ID could change.<\/p>\n<h4>Features<\/h4>\n<p>Adds a pagenamed_name-of-your-page class to each menu \/ list item for you to style them different, working-around WP limitation on not saving page name or title or url of the related page in menu items DB rows.<\/p>\n<p>Better than using IDs, since the permalink MUST stay FOREVER for Google indexing, while menu and page ID are important only inside WP database.<\/p>\n<ul>\n<li>Adds a pagenamed_name-of-your-page class to each menu \/ list item for you to style them different.<\/li>\n<li>Works for either custom menus or page listings made with the previous wp_list_pages() function.<\/li>\n<li>Extra code to remove unwanted useless classes from menus (Need plugin editing)<\/li>\n<\/ul>\n<h4>Future features<\/h4>\n<ul>\n<li>It will keep track of changes made to permalink to update the stylesheet (even though is not recommended for an old page, to prevent losing indexed value in google)<\/li>\n<li>Option in admin panel to remove unwanted useless classes from menus.<\/li>\n<\/ul>\n<p>Don\u2019t forget to rate it and tell it works! \u232a\u232a\u232a\u232a\u232a\u232a\u232a\u232a\u232a\u232a\u232a\u232a<\/p>\n<h3>Instructions<\/h3>\n<p>Easy: Install and activate. No options yet (future releases will)<\/p>\n<p>Check out <a href=\"http:\/\/socialblogsitewebdesign.com\/wordpress-plugins\/pagenamed-menu-classes\/\" rel=\"nofollow ugc\">PageNamed Menu Classes plugin page<\/a> for bug reports, updates, help, and to find other interesting plugins.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>The very first plugin to style your menu list or page listing items differently. ( i.e. custom icons for each menu! )<\/p>\n","protected":false},"author":65,"featured_media":319449,"comment_status":"open","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"slim_seo":{"title":"PageNamed Menu Classes - \u8587\u6653\u6735\u63d2\u4ef6\u76ee\u5f55","description":"The very first plugin to style your menu list or page listing items differently. ( i.e. custom icons for each menu! )"},"footnotes":""},"categories":[1],"tags":[28535,3280,71,2008,234],"class_list":["post-125504","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-uncategorized","tag-different","tag-icon","tag-post","tag-specific","tag-style"],"_links":{"self":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/125504","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/users\/65"}],"replies":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/comments?post=125504"}],"version-history":[{"count":0,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/posts\/125504\/revisions"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media\/319449"}],"wp:attachment":[{"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/media?parent=125504"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/categories?post=125504"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.weixiaoduo.com\/plugins\/wp-json\/wp\/v2\/tags?post=125504"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}