WordPress.org

Forums

How to convert post title into a number. (3 posts)

  1. krystiank
    Member
    Posted 4 years ago #

    Hi,

    Is it possible to convert post title into a number , I need to create a category that will be listing post by numbers. Something like this site.

    http://www.project-cheops.com/session

  2. alchymyth
    Forum Moderator
    Posted 4 years ago #

    do you mean how to give each post a number, starting with 1 for the oldest post, and increasing with each new post?

    then check this article
    you probably need to adapt the code to do it only for posts of one category

  3. krystiank
    Member
    Posted 4 years ago #

    how can I display it in the loop?

    Would that be correct?

    `<?php $my_query = new WP_Query('category_name=przekazy');
    while ($my_query->have_posts()) : $my_query->the_post();
    $do_not_duplicate = $post->ID;?>
    <?php echo get_post_meta($post->ID,'incr_number',true); ?>
    <?php endwhile; ?>`

Topic Closed

This topic has been closed to new replies.

About this Topic

Tags

No tags yet.