Opened 14 years ago
Last modified 5 years ago
#14551 reopened defect (bug)
menu item : current_page_parent : issue with Front page displays
Reported by: | Owned by: | ||
---|---|---|---|
Milestone: | Priority: | normal | |
Severity: | normal | Version: | 3.0 |
Component: | Menus | Keywords: | has-patch |
Focuses: | Cc: |
Description
Settings > Reading > Front page displays: set to your latest posts
Settings > Reading > Posts page: set to anything
When the menus are building, they are only checking that something was set by the dropdown for posts page, even though the parent setting says the posts are to be on the home page. The pages on the site have the correct logic, however the menu adds "current_page_parent" to the item selected in the "Posts page" menu, even though it's not really the parent.
The work around is to just remember if you switch from having posts on a different page back to having them on the front, you need to set the "Posts page" back to "select" and everything works correctly, but getting users in my multi-site install to do that might be asking a bit much.
Attachments (1)
Change History (13)
#2
@
14 years ago
Change to the two lines: need to remove (int) from get_option.
$front_page_displays = get_option( 'show_on_front' );
if($front_page_display == 'posts'){$home_page_id=0;}
#3
@
14 years ago
- Cc wojtek.szkutnik@… added
- Keywords has-patch needs-testing gsoc added; current_page_parent menu posts on page removed
#4
@
11 years ago
- Keywords close added; has-patch needs-testing gsoc removed
- Resolution set to invalid
- Status changed from new to closed
- Version changed from 3.0.1 to 3.0
Invalid. When front page is set to latest posts, you are not able to select the page for posts option.
#6
@
11 years ago
Hey guys, either my original post wasn't clear, or it's not being read properly. I understand that the first time you come to the page (Settings > Reading) the option "Front page displays" is set to "Your latest posts" and everything is grayed out. That's all well and good.
BUT, if a user switches to use a static page for their front page, and moves the posts to another page on their site, AND then goes back to displaying latest posts on the homepage (without resetting "front page" and "posts page" settings back to "select") , the programming logic of the menus doesn't work properly.
#8
@
11 years ago
As an additional point of clarification, while I realize that when someone puts the setting back to front page display latest posts, that visually the other settings are disabled, the database still retains the fact that you've previously selected another location for posts and for the front page that the menu logic is considering, even though it shouldn't.
Possible solution:
File: wp-includes/nav-menu-template.php
Add after line 260:
$front_page_displays = (int) get_option( 'show_on_front' );
if($front_page_display == 'posts'){$home_page_id=0;}
This checks to make sure the first toggle is set to have page or posts on the front. If posts, then reset $home_page_id (page_for_posts) to 0 (value when drop down is set to "select").
I know there are possibly a few other locations you could add similar logic. I'm not sure what else the $home_page_id (page_for_posts) value would be used for.