I want to make a parallax type link, but I have no idea how to go about it yet. I need to get all post titles with # link and then I can try the parallax thing.

My current category page code bellow. I want to show all post in there..

<div class="content">
    <?php if ( have_posts() ) : ?>

    <h2><?php single_cat_title('',true); ?></h2>


   <dl>
    <?php while ( have_posts() ) : the_post();

           ?>
    <dt><?php the_title(); ?></dt>
    <dd><?php the_content(); ?></dd>
    <?php endwhile; 
            ?>
    <?php else : ?>
    <?php endif; ?>
    </dl>
  </div>

I get all post titles with content nicely. No problem .. but I want to add one div after H2 then want to show

<ul>
<li data-slide="1">title </li>
<li data-slide="2">title </li>
<li data-slide="3">title </li>
<li data-slide="4">title </li>
...
..

</ul>

How could I do that?

Category page will be like bellow

**Category Title**

All Post Title (list)



(under all post )

--------------
Post title
Post Content
---------------

Post title
Post Content
---------------

Post title
Post Content
---------------

Post title
Post Content
---------------

Post title
Post Content
---------------

2 Answers
2

Have not tested it but this should get you to your goal. I believe Accore LTD has it correct as well, except your slide #s will be post ID, instead of slide-1, slide-2

<div class="content">
  <?php if ( have_posts() ) : ?>
  <h2><?php single_cat_title('',true); ?></h2>
 <div>
   <ul>
     <?php 
     $inc = 1;
     while ( have_posts() ) : the_post(); ?>
     <li data-slide="<?php echo $inc; ?>"><?php the_title(); ?></li>
     $inc++;
     <?php endwhile; ?>
     <?php else : ?>
     <?php endif; ?>
    </ul>
  </div>

Leave a Reply

Your email address will not be published. Required fields are marked *