I want to show my blog's sidebars depending on the page URL. So if the page URL is http://xyz.com/abc then the sidebars should not be shown otherwise they should. I tried making some changes in my page.php file under wordpress but its not working. Here is the code I used: <?php If (get_permalink() != "http://xyz.com/abc") then ?> <?php get_sidebar(); ?> PHP: Can someone tell me what am I doing wrong?
replace 45 with your page ID. <?php if (is_page('45')) { echo ' ' ; } else { echo get_sidebar(); } ?> Code (markup):
Thanks MeetHere. There is still an issue. Though the right sidebar has gone but the left sidebar is still visible. What can I do to remove that? FYI... I am using copyblogger's three column theme.
I didn't get that MeetHere I want to remove the sidebars not show them. I guess echo will make them visible.
no man, we are doing "else" command.. we used echo' ' (here we kept nothing in between ' ' ) <?php if (is_page('45')) { echo ' ' ; } else { echo get_sidebar2(); } ?> <?php if (is_page('45')) { echo ' ' ; } else { echo get_sidebar1(); } ?> Code (markup):
oh ok If you mean that ... I know. But the issue is in my page.php file I don't find any reference to my left sidebar... there is a reference to get_sidebar(). Now sidebar.php again has no reference to left sidebar probably if it is possible for you to check copyblogger 3 column theme, you will understand it more clearly.
Yes pipes ... It got sorted.. Though right sidebar was pretty straightforward but for left sidebar I had to go inside leftsidebar.php file and put my if-else conditions there. Thanks for asking, appreciate it.