How to display a div block only on the main page on Datalife Engine?

280 Views Asked by At

I have a div block that I only want to display on the first page. I mean, if the user is on

http://mywebsite.com/

it displays the div. But if he navigates to the second page of the posts

http://mywebsite.com/page/2

it hides that div. I am using Datalife Engine.

Div example:

<div class="example"> This is a test </div>

Can this be done?

2

There are 2 best solutions below

0
Pedro Lino On BEST ANSWER

For datalife engine, display just on the first page we use:

[page-count=1]Content goes here[/page-count]
16
Victorino On

follow this and all be worked fine.

  <head>

  <script src="http://code.jquery.com/jquery-1.10.1.min.js"></script>
  <script src="http://code.jquery.com/jquery-migrate-1.2.1.min.js"></script>


  <script type="text/javascript">

     $(document).ready(function(){


        if( $('#mainPage').length > 0 ) {

           $("#hideMe").css({"display": "block"});

        } else {

           $("#hideMe").css({"display": "none"});

        }


      });//end doc ready function 


  </script>


  </head>

  <body>

     <div id="mainPage">  </div>


      <div id="hideMe">lorem ipsum</div>

  </body>

hope it helps you

example http://jsfiddle.net/viktorino/56ea5/