更改Wordpress中的帖子页面?

时间:2013-03-20 00:13:25

标签: wordpress post navigation selected posts

主题标题可能有点误导,但我真的不知道提出这个问题的标题,但由于它与更改帖子页面有关,我觉得没问题。

所以我实际上想出了如何更改帖子页面并设置静态首页。现在我有一个登陆页面,这是我的首页,然后是一个日记页面,这是我的帖子出现的地方。

我的问题是,当我点击帖子时,导航中的日记链接不会保持选中状态。我希望用户知道,当他们点击帖子时,他们仍然在日志区域中通过选择导航中的日志链接,但我无法弄清楚如何使日记链接保持突出显示为目前的链接。

当用户转到日记帐(显示我所有帖子的页面)时,导航中的日记链接将保持选中状态。只有当用户点击不再选择日记的帖子时才会这样做。

所以我想我的问题是: 如何在帖子上保留最新/选中的帖子页面链接?

我的意思是,我想我已经知道为什么不通过查看网址来保持选择权。当我在日志页面上时,网址是(顺便说一句,我在本地工作,这就是为什么我无法链接到网站):
http://localhost/wordpress/journal/

当我在帖子上时,网址看起来像这样:
http://localhost/wordpress/example-post/

真的应该是这样的:
http://localhost/wordpress/journal/example-post/

以便所有帖子都将该期刊识别为其期刊,但我无法弄清楚如何做到这一点。

无论如何,任何帮助将不胜感激。提前致谢!



**编辑*
结果只是让网址http://localhost/wordpress/journal/example-post/无法正常工作。这告诉我,php中有一些东西需要更改,添加和/或编辑。所以我开始检查导航中的日志链接,看起来在帖子页面上它正在获得一些它没有进入帖子页面的类。

以下是帖子页面上日记链接的样子:
<li id="menu-item-46" class="menu-item menu-item-type-post_type menu-item-object-page current-menu-item page_item page-item-41 current_page_item current_page_parent menu-item-46"><a href="http://localhost/wordpress/journal/">Journal</a></li>

以下是帖子页面上的日记链接:
<li id="menu-item-46" class="menu-item menu-item-type-post_type menu-item-object-page current_page_parent menu-item-46"><a href="http://localhost/wordpress/journal/">Journal</a></li>

我对两者进行了比较,看起来帖子页面上的日记链接缺少了帖子页面上的日记链接所具有的几个类。主要是class="current-menu-item current_page_item",它们需要显示为选定/当前类(实际上,它只需要其中一个类显示为选中/当前)。无论如何,我试图找到在php中添加这些类的位置,看起来它们都显示为wp-includes/nav-menu-template.php。该文件看起来相当复杂,我不想弄乱它并破坏网站,但任何运行Wordpress 3.5.1的人都应该拥有我所拥有的相同文件,如果你想看看它。我猜这就是问题所在,我想我需要在主题函数中添加一些东西来解决问题。我只是不知道会是什么:/



**编辑*

帖子页面的屏幕截图
这是帖子页面的样子。注意JOURNAL是黑色而其他链接是灰色的。我正试图让期刊在发布时保持黑色/选中/当前状态 This is what the posts page looks like. Notice how JOURNAL is black while the other links are gray. I'm trying to get JOURNAL to stay black/selected/current when on a post

帖子页面的屏幕截图
这是帖子页面的样子。请注意JOURNAL如何不是黑/选/当前。相反,它像所有其他导航链接一样是灰色的。我正试图弄清楚如何在帖子和/或帖子页面上让JOURNAL保持黑色/选中/当前。换句话说,当您在日记帐页面或日记帐分录页面上时(日记帐页面显示所有日记帐分录,而日记帐分录页面只显示您所在的条目)。 This is what the post page looks like. Notice how JOURNAL is not black/selected/current. Instead it is gray like all the other nav links. I'm trying to figure out how to get JOURNAL to stay black/selected/current when on both the post and/or the posts page. In other words when you are on the journal page or the journal entry page (journal page displays all journal entries, while journal entry page just displays the entry you are on).

2 个答案:

答案 0 :(得分:0)

试试这个:转到settngs-&gt;永久链接并选择自定义。添加:/ journal /%postname%

我刚试过这个,它对我有用。希望它也适合你!

-Lisa

答案 1 :(得分:0)

尝试在样式表中使用css类

ul li.current-menu-item {color:red;}

或其他

ul li.current-menu-item a {color:red;}

它适用于此