subfusioncom
Forum Replies Created
-
Forum: Fixing WordPress
In reply to: parent child questionI’m getting there….
The code below will write a sub page class as the parent page ID number but I’d like it to write the class as the parent page name (numbers dont work in css).
if (is_page('naturopathy')) { echo 'home'; } elseif (is_page('about')) { echo 'about'; } elseif (is_page('services')) { echo 'services'; } elseif (is_page('products')) { echo 'products'; } elseif (is_page('contact')) { echo 'contact'; } elseif ($post->post_parent) { echo $post->post_parent; }
Forum: Fixing WordPress
In reply to: parent child questionif (is_page('widgets')) { echo 'home'; } elseif (is_page('about')) { echo 'about'; } elseif (is_page('services')) { echo 'services'; } elseif (is_page('products')) { echo 'products'; } elseif (is_page('contact')) { echo 'contact'; } elseif ($post->post_parent) { the_title('','',false) echo '[post_parent]'; }
I can create the right class for a specific page as in the code above but in the last line I’m trying to print the parent page name so that the sub page inherits the parent page class. I realise [post parent] isn’t going to work! I’m still new but once I’ve grasped this then I think I can be more self sufficient.
Thanks for your help so far adambrown any more suggestions would be appreciated….
Am I nearly there yet?
Forum: Fixing WordPress
In reply to: parent child questionThanks for that. I can now make the class the same as the page name but how do I make the class the name of the parent page for a sub-page?
Forum: Fixing WordPress
In reply to: <h1> other than the_titleThanks, much appreciated