• Is possible show a random link every a random number in the main index….for example, i show 12 article in the index, i would put a link one time after post 2, sometime after post 7, sometime after post 11, randomly.

    I’ll put in the link some of my sponsor

    This is my code

    <?php $wp_query->query_vars[“cat”] = 11; ?>
    <?php $wp_query->query_vars[“showposts”] = 12; ?>
    <?php $wp_query->get_posts(); ?>
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>

    <div class=”post”>

    ” rel=”bookmark”><?php the_excerpt(); ?>

    <h1 class=”story_title” id=”post-<?php the_ID(); ?>”>” rel=”bookmark”><?php the_title(); ?></h1>

    <p class=”date”><?php the_time(‘m-j-y’); ?></p>

    </div>

    <?php endwhile; else: ?>
    <h2>Not Found</h2>
    <p><?php _e(“Sorry, but you are looking for something that isn’t here.”); ?></p>
    <?php endif; ?>`

Viewing 2 replies - 1 through 2 (of 2 total)
  • Thread Starter Marcomail

    (@marcomail)

    i think it can bel simple, but i’m not a php expert.

    A function to take a random number from 1 to 12. Insert in the loop a php code that compare the random number with the post counter, and if the same show the link.

    but i don’t know write this in php

    Thread Starter Marcomail

    (@marcomail)

    up

Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘insert a random link between index article’ is closed to new replies.