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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T04:38:46+00:00 2026-06-08T04:38:46+00:00

was wondering if anyone could help me out. I have been looking all over

  • 0

was wondering if anyone could help me out. I have been looking all over the place for an answer and can’t seem to find one.

I am kind of a novice at PHP and i am pretty familiar with WordPress. I added three new layouts to the default twentyeleven theme. The way I envisioned this working was if someone selected a particular layout an extra sidebar would appear. So I came up with the following (yeah i know it probably isn’t correct but I did it myself and it works…lol)

            $options = themeawesome_get_theme_options();
            $classes = $options['three-column' || 'three-column-left' || 'three-column-right'];
            if ( 'content' != $classes ) {
            get_sidebar('alt');
            }

like said it works great and shows the alt sidebar if any of those choices are selected in the theme options panel.

Only thing is I get the following error:

Undefined offset: 1 on line 8

line 8 being the 2nd line of code above.

Can anyone help me remove this error. Any help is greatly appreciated and 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-08T04:38:48+00:00Added an answer on June 8, 2026 at 4:38 am

    You cannot use multiple indexes in an array, as you’re attempting to do with:

    $classes = $options['three-column' || 'three-column-left' || 'three-column-right'];
    

    I’m not exactly sure what goal you’re trying to achieve, so I have multiple answers as to how to fix it.

    First, declare the list of available themes:

    $themes = array('three-column', 'three-column-left', 'three-column-right');
    

    If you want an array, $classes, with each class, try:

    $classes = array();
    foreach ($themes as $theme) {
        if (isset($options[$theme])) {
            $classes = $options[$theme]; 
        }
    }
    

    If you want to get the “first theme available”, try:

    $classes = '';
    foreach ($themes as $theme) {
        if (isset($options[$theme])) {
            $classes = $options[$theme];
            break;
        }
    }
    

    Because you’re following if-statement (if ('content' != $classes)) is checking for a single string, the second of my examples may suit your needs.

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

Sidebar

Related Questions

I was wondering if any one could help me out; I have a table
I was wondering if anyone could help me out with this. I am running
I was wondering if anyone could help me out with jQuery file tree (
I was just wondering if anyone could help out with how to do the
Wondering if anyone can help with the following. Basically I have a form which
i was wondering if somebody could help me out. I have a plan of
i was wondering if anyone could help me with css. ive been stuck on
Was wondering if anyone could help me out here. I don't dont much with
I was wondering if anyone could help me out, or point me in the
I was wondering if anyone could help me out with finding a simple regular

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.