Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8433381
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 10, 20262026-06-10T06:22:15+00:00 2026-06-10T06:22:15+00:00

First let me say that I have been working on this issue for about

  • 0

First let me say that I have been working on this issue for about 2 weeks and I have looked all over the place for an answer. Ive gone to various forums, blogs, the WordPress Codex and just about any and all places I could find. I still cannot get this to work properly. As a last resort I am coming here to see if maybe someone can assist me with it.

My issue is this. I am building a free WordPress theme, http://wp-awesome.themeawesome.com. I will be submitting it to the WordPress Theme Repository and hopefully get it hosted so people can download it. One of the requirements is that a theme cannot generate any errors. Everything is working perfectly and there are no errors except one. I get the following error message when I go to a second page:

*Notice: Undefined variable: do_not_duplicate in /–/–/–/–/–/–/wp-awesome/index.php on line 68*

As you can see on the front page there is a featured post slider. This slider is will display posts that are tagged “featured”. I am using the following code for this specific query:

    <?php 
            $mytag = mytheme_option( 'featured_tag' );
            $thecount = mytheme_option( 'featured_count' );
            $my_query = new WP_Query("tag=$mytag&showposts=$thecount");
            while ($my_query->have_posts()) : $my_query->the_post();
            $do_not_duplicate[] = $post->ID;
        ?>

// post stuff here

<?php endwhile; ?>

Now obviously on the home page I do not want the posts that are displaying in the slider to display on the front page in the regular loop below it. So i found the following code that seems to work great:

    <?php 
if (is_home()) { 
    $paged = (get_query_var('paged')) ? get_query_var('paged') : 1;
    query_posts(array(
        'post__not_in' => $do_not_duplicate,
        'paged' => $paged
    )); }
if (have_posts()) : while (have_posts()) : the_post(); ?>

// post stuff

<?php endwhile; ?>

the only problem is when you click on another page at the bottom the error shows up:

*Notice: Undefined variable: do_not_duplicate in /–/–/–/–/–/–/wp-awesome/index.php on line 68*

I know the error is appearing because when you go to a second or third page, there is nothing defining the do_not_duplicate param. Any ideas how to fix this?

Any help is greatly appreciated and I thank you in advance.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-10T06:22:16+00:00Added an answer on June 10, 2026 at 6:22 am

    Easy & quick fix ( not necessary best ) would be to declare the $do_not_duplicate variable in the theme’s header.php file located in: wp-content/themes/YOUR_THEME/header.php. If it’s an array, you might need to declare it’s elements. Like this:

    <?php
      //  declaration of $do_not_duplicate array
      for ( $i = 0; $i < 100; $i++ ) {
        $do_not_duplicate[$i] = 0;
      };
    ?>
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

First, let me say that I have been at this for far too long,
First, let me just say that I have searched for information on this topic;
First of all, let me say I am very new to rails, have been
Let's say I have a form that collects a first name and a last
First let me say that I did see this article: How to remove AspxAutoDetectCookieSupport
I can't figure this one out. At first let me say that my cache
Let's say that there are two PHP functions. function first() { $keyword = $this->input->post('keyword');
First of all, let me say that I am not a professional coder -
First let me say I have read this useful article thoroughly and am using
First of all, I would like to say that I have used the search

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.