andre77
Forum Replies Created
-
I tried your code, but it didnt work. And to me it seems to be a bit unlogical.
The page 25, is a parent page for several levels of ancestor pages.
So if I understand the code correctly it means that: if the current page is an ancestor, and also has the ID 25 – OR if it is an array of page 25, then load optional code.
To me, this looks like the statement will never return true, as the parent page (25) is not an ancestor page to begin with.
When I said categorized, I was not refering to how WordPress gategorizes posts. I was simply trying to make a point that the menu system of the webpage is complex, and that I have manually grouped the static pages into many categories, using parent, and subpage.
I have looked at the conditional tags page in the wordpress Codex, but I havent seen any examples of what I am trying to achieve 🙁
Hey again!
I guess I should have been more specific in my last reply, because the setup is more complex, and therefore your code isn’t specific enough to work. The webpage is built up as an CMS-webpage, consisting of mainly static pages. The pages are categorized in about seven cagegories, which have lots of sub/ancestor pages on their own (in several levels deep). I am calling a specific for each and every one of those categories, who contain the navigation for that category. Therefor the sidebar navigation, must also be present when an ancestor page of a parent is loaded.
The webpage will also contain a traditional “blog”, showing only posts. And this blog will probably also need to have its own specific sidebar as well.
The code you provided, does not make any difference between the main static page, and the “blog” page. And for some reason the line in the context you gave, for example:
if (is_page(25) || in_array(“25”,$post->ancestors)){
dynamic_sidebar( ‘sidebarmenu_about_us’ );…does not work. When I am on page 25, then no sidebar gets loaded at all. But a sidebar is beeing loaded otherwise, as far as the first 6 lines of the code.
If you could give me an exampel that would work for the above scenario, I would be really greatful!
Thanks a lot for your answer!
I am not getting your code to work, but I am still trying out different things ,-)
But how can the code be written differently. I see no need for the child pages to be an array at all…The reason why I have the “in_array” in my code, is simply because I got this example from another source, and it seems to work at least when loading “pages”. But the main thing I am after is to get WordPress to load different sidebars depending on which parent page (and their subpages) I am on – AND I want to be able to control in the same matter which sidebar gets loaded when viewing posts/blogg.
What code would you use in order to accomplish this?
Forum: Hacks
In reply to: JQuery Vertical Accordion Menu Bold or Highlight Current Page?Hey!
I got help from the developer, which informed me about the
“.current-menu-item” class, which can be targeted through css. The css code I am using is for example:
li.current-menu-item > a{
text-decoration: underline;
color: #ae1e58;
}I hade to use the “>” child selector, as otherwise the links in the nested list also get highlighted. But you´ll just have to play around with this class, and see what fits you.
Forum: Plugins
In reply to: jQuery Accordion Menu – Menu not staying expandetNever mind, a couple of days later it just started to work again. My guess is that the “cookie”-function stopped working for some reason?
Because now I get the same results, when I disable cookies.
Forum: Hacks
In reply to: JQuery Vertical Accordion Menu Bold or Highlight Current Page?Please let me know if you find a solution for this… 😛
Forum: Plugins
In reply to: [WP-dTree] WP-dTree – Replicate Icon Expand Menu FunctionLooking for an answer to the same question ,-)
Forum: Plugins
In reply to: [WP-dTree] WP-dtree is only outputting the code behind the menuThanks alot! 🙂 Its working now!
I missed this info in the description tab. I was mostly searching through the forum and FAQ for the answer.