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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T15:53:11+00:00 2026-05-26T15:53:11+00:00

Complete newbie to programming :) i am fiddling around with a WordPress theme and

  • 0

Complete newbie to programming 🙂

i am fiddling around with a WordPress theme and hit a roadblock. If i put this in archive.php,

<?php 

if (is_category(array( 9, 13, 24,)) {
 echo 'Light is GREEN';
  }else {
 echo 'Light is RED}';
 ?>

That part works fine, when i go to category 9, 13, 24 i get “light is Green” and “light is red” for all other categories.

Now i have this function which gets the id’s of categories from theme options where i need to echo “light is green”

function am_get_cat_layout_ids()
{

                global $am_option;
                $catnumend = $am_option['main']['category_onecolumn_hidden']-1;
                for($i=0; $i<$catnumend; $i++)
                {

                    $value = $am_option['main']['category_onecolumn_'.$i].',';


                }

                return $value;
}

if i echo $value instead of return, i get the category id’s say 2, 15, 7, 34, fine but if i do this :

  <?php 

if (is_category(array(am_get_cat_layout_ids())) {
 echo 'Light is GREEN';
  }else {
 echo 'Light is RED}';
 ?>

its not working.

anything that can be done to make it work?

Thank you ,
Srik

  • 1 1 Answer
  • 1 View
  • 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-26T15:53:11+00:00Added an answer on May 26, 2026 at 3:53 pm

    Try this:

    function am_get_cat_layout_ids()
    {
        global $am_option;
        $ret = array();
        $catnumend = $am_option['main']['category_onecolumn_hidden']-1;
    
        for($i=0; $i<$catnumend; $i++)
        {
                $ret[] = $am_option['main']['category_onecolumn_'.$i];
        }
    
        return $ret;
    }
    

    and

    if (is_category(am_get_cat_layout_ids()) {
        echo 'Light is GREEN';
    }else {
        echo 'Light is RED}';
    }
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm really new at network-programming, so I hope this isn't a complete Newbie-question. I
I am a complete newbie to Perl, with PHP coding experience and I put
I'm a complete newbie to Windows and COM programming, trying to use com4j in
I'm a complete newbie to programming and am having a lot of trouble with
I am a complete Android programming newbie. I have completed some tutorial examples like
I'm a complete newbie to Objective-C, coming from a background of PHP, assorted dialects
I'm pretty much a complete newbie to PHP. My background is C/C++ and C#.
I'm a complete newbie to C# so excuse me if this looks weird. I
I'm a complete newbie to Android, and this may actually be more of a
I'm a complete newbie to programming and am having problems implementing a SELECT query

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.