link in sidebar only home

Posted in: Newspaper
Post count: 57

I need add this code in sidebar, show only in home

<?php if (is_home() & !is_paged()) { ?>
//<ul>	
	<li><a href=""></a></li>	
</ul>
<?php } ?>

Can you helpme

  • This topic was modified 9 years by gpm79.
  • This topic was modified 9 years by gpm79.
Post count: 22421

Hello,
The homepage does not have a standard sidebar if it;s created in visual composer so any custom code can be added on the homepage in the page builder.
If you want to alter the page template php, then you will need to edit the page template file that you use on your page:
https://www.screencast.com/t/ttPqhLDBo
Here are the page templates available in our theme: https://forum.tagdiv.com/page-templates-2/
Thank you!

Post count: 57

If I put this code I see it perfect

<?php echo '<p>Hola Mundo</p>'; ?>

But if I put this I see nothing

<?php if (is_home() & !is_paged()) { ?>
//<ul>	
	<li><a href="http://google.com">aaaaa</a></li>	
</ul>
<?php } ?>

Why? Is the code wrong?

  • This reply was modified 9 years by gpm79.
Post count: 20688

Hi,

Please provide more details about what you want to achieve. Maybe there is an easier way of achieving this. I can see that you are trying to insert a html list containing a link, you could use a raw html element for Visual composer – and place it in the sidebar like this – https://www.screencast.com/t/U9E6HAVLj or if you use a widgetised sidebar like this – https://www.screencast.com/t/T07InlA1yQi5

Thanks

Viewing 4 posts - 1 through 4 (of 4 total)
The forum ‘Newspaper’ is closed to new topics and replies.