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 7069725
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T05:28:50+00:00 2026-05-28T05:28:50+00:00

This question is regarding wordpress . I have two variables $random_n and $adcount declared

  • 0

This question is regarding wordpress.

I have two variables $random_n and $adcount declared in each of index.php , archieve.php, search.php and single.php files at the very first line.

The variables are declared as follows:

<?php $random_n = randomNumber();?> 
<?php $adcount = 1; ?>

randomNumber() is a function inside function.php.

If I move those variables to header.php and remove them from all these files, it stops working. :/ The variables can’t be found in index.php, archieve.php, search.php, single.php if they are placed in header.php

I’ve also tried putting this code inside a new file and including that file to index.php, archieve.php, search.php, and single.php, but it hadn’t helped as well.

  • 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-05-28T05:28:51+00:00Added an answer on May 28, 2026 at 5:28 am

    If the variable is somehow related to your blog configuration, you should use the wordpress option API to build this (see here , search for option).

    If your variable is random (your function name hints that) a way to work around this would be using session variables to store those values.

    A good tutorial on how to use session variables in wordpress can be found here:
    http://www.myguysolutions.com/2010/04/14/how-to-enable-the-use-of-sessions-on-your-wordpress-blog/

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

This question is regarding getopt function in php. I need to pass two parameter
This is a very specific question regarding MySQL as implemented in WordPress . I'm
Again I have a question regarding this plugin: http://t.wits.sg/2008/06/20/jquery-progress-bar-11/ What I want to achieve
I have this very straight forward question regarding Thread and Timer classes in Java
This question is regarding Google bots and what they actually do with session variables,
I have a question questions regarding SEO, Robots.txt and wordpress Here's what my robots.txt
I have a question regarding WordPress, specifically version 3.0 and newer. Does anyone know
After reading this question regarding Linux: Open Terminal From Eclipse I have the same
I have this (simple) question regarding an array. I am trying to get the
This is a question regarding Ajax Iframes. I have a function to open an

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.