Nevermind, realised my mistake.
All good.<?php if (stripos($_SERVER['REQUEST_URI'],'/page-i-dont-want-code-to-show-on/') !== false) {echo '';}
else
{echo 'image code here';}
?>
Hi All
I've added some code to the wordpress sidebar which simply shows an image link. I'm trying to make it so this code doesn't show on a specific page though, as the image is the same as the one on the page it links too.
Not a coder, but was thinking this could be done with php if / else statements?
Was working on something like:
But this just removes the whole sidebar - I hotched it together from reading other forum posts. Anyone know how I can do this?<?
$comppage = "/page-i-dont-want-code-to-show-on/";
$comppage = $_SERVER['REQUEST_URI'];
if($comppage==$currentpage) {
echo "";
else
echo "image code here";
}
?>
Cheers
Paul
Paul Smith
Gifts Guide UK
Nevermind, realised my mistake.
All good.<?php if (stripos($_SERVER['REQUEST_URI'],'/page-i-dont-want-code-to-show-on/') !== false) {echo '';}
else
{echo 'image code here';}
?>
Paul Smith
Gifts Guide UK
For non-coders there is plugin called WordPress › Widget Logic that makes it fairly easy and without changing the php code.
This adds an extra field to each widget where you can add a conditional statement to control when it should display.
e.g.
- is_home()
- is_page(array(71,1548))
- !is_page(9) /* is not */
- in_category(array(252))
- is_category('softtoys')
kickflip (13-11-10)
That looks like a great plugin, cheers!
There are currently 1 users browsing this thread. (0 members and 1 guests)
Bookmarks