I am working in a Wordpress website and I need to pass the url of a page as a argument of a function. In this case I am using
bloginfo('url');
to retrieve the base url of the site.
So my code is
<?php
$portfolio_link = bloginfo('url');
if ( ! function_exists( 'ow_nav' ) ) {
function ow_nav( $nav_position ) {
?>
<nav id="ow-nav-<?php echo $nav_position; ?>" class="ow-nav clearfix ow-nav-<?php echo $nav_position; ?>">
<ul class="ow-nav-list">
<?php ow_nav_item( '#home', 'Home' ); ?>
<?php ow_nav_item( '#about', 'About' ); ?>
<?php ow_nav_item( '#criteria', 'Investment Criteria' ); ?>
<?php ow_nav_item( '#approach', 'Approach' ); ?>
<?php ow_nav_item( '#team', 'Team' ); ?>
<?php ow_nav_item( $portfolio_link, 'Portfolio' ); ?>
</ul>
</nav>
<?php
}
}
if ( ! function_exists( 'ow_nav_item' ) ) {
function ow_nav_item( $link, $text ) {
?>
<li>
<a href="<?php echo $link; ?>">
<span class="ow-txt"><?php echo $text; ?></span>
<span class="ow-dot"></span>
</a>
</li>
<?php
}
}
But when I do that, that variable gets leaked in my HTML, displaying the url in a random place in the DOM.
Any ideas?