WordPress Sidebar Php Code
wordpress conditional statement in php?
I want to add content in the file sidebar.php will be conditional on the actual page to stay. Assume I have 5 pages and each page has its own description, it looks good in the sidebar. Can the appropriate code available for this assertion: if page = some_page echo "My text some_page" but if the page = some_page_2 echo "my text some_page_2" if page = some_page_3 echo "My text some_page_3." . . if page = some_page_5 echo "my text some_page_5" So, what is the variable being checked (the ID page of WordPress) and how I can print my real paragrahp text in the statement, if anything? Thanks!
You can do this using the variable $ _SERVER ['REQUEST_URI']. Here's an example: Show HTML
}elseif ($_SERVER['REQUEST_URI'] == "/index.php"){
?>
Show Different HTML
}else{
?>
Screen if the logic does not match any of the above
}
?> Stephen Williamson, server engineer, http://www.HostMySite.com?utm_source=bb
How to add Tabbed Sidebar Widget using Easy Tabs in Thesis theme
|
|
Wordpress $8.57 No Synopsis Available |
|
|
Adobe 65059920 Dreamweaver CS5 v.11.0 for PC $167.97 The Dreamweaver CS5 Software from Adobe is a powerful web editor for Windows that supports HTML, CSS, and PHP. Dreamweaver allows you to create web pages using a powerful visual editor, or by directly editing code. It is compatible with many popular content management systems, including WordPress, Joomla , and Drupal. Dreamweaver features tools that will help you write cleaner code, whether it be straight HTML, JavaScript, or Ajax. You'll be able to add video in the FLV format to web projects with ease. You'll also have access to a wealth of training and community tools, including user forums, to help you hone your web creation skills. |
|
|
The WordPress Anthology $29.83 No Synopsis Available |
|
|
Using WordPress $21.24 No Synopsis Available |
|
|
Wordpress Bible $42.49 No Synopsis Available |
|
|
Wordpress in Depth $18.33 No Synopsis Available |
Tagged with: css • reference • tutorial • webdesign • wordpress • wordpress sidebar php code
Filed under: WordPress Marketing Strategies
Like this post? Subscribe to my RSS feed and get loads more!






Leave a Reply