Quantcast
Channel: WordPress › Support » Forum: Hacks - Recent Topics
Viewing all articles
Browse latest Browse all 8245

alejom84 on "Insert custom sidebar if is_frontpage"

$
0
0

Hello everybody, I created a custom sidebar in functions.php and inserted the following piece of code to display it next to the frontpage slider:

<div style="position: absolute;right: 260px;z-index: 4;">
<?php if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar-Demo') ) : ?>
<?php endif; ?>
</div>

So far so good, it is displaying correctly, the problem I'm having is that it's also displaying in all the pages. I'm trying this:

<?php if ( is_frontpage() ) {
	if ( !function_exists('dynamic_sidebar') || !dynamic_sidebar('Sidebar-Demo') ) {
		echo '<div style="position: absolute;right: 260px;z-index: 4">';
			dynamic_sidebar();
		echo '</div>';
	}
} ?>

And many other variations but I can't get it to work, any help will be greatly appreciated. Thanks in advance.


Viewing all articles
Browse latest Browse all 8245

Trending Articles