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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 18, 20262026-06-18T09:33:57+00:00 2026-06-18T09:33:57+00:00

My code only executes the if statement, but does not continue to execute the

  • 0

My code only executes the if statement, but does not continue to execute the else part. Ive tried each statement individually and they work fine. But, when I put them together, only the first statement is executed. What am I doing wrong?

I’ve tried this:

function body_google_webfonts() {
    if( $settings['font_type_body'] = "Handlee") :
        wp_register_style('body-google-webfonts', 'http://fonts.googleapis.com/css?family=Handlee');
        wp_enqueue_style( 'body-google-webfonts');
    elseif ( $settings['font_type_body'] = "Kreon") :
        wp_register_style('body-google-webfonts', 'http://fonts.googleapis.com/css?family=Kreon');
        wp_enqueue_style( 'body-google-webfonts');
    endif;
}

and this:

function body_google_webfonts() {
    if( $settings['font_type_body'] = "Handlee") :
        wp_register_style('body-google-webfonts', 'http://fonts.googleapis.com/css?family=Handlee');
        wp_enqueue_style( 'body-google-webfonts');
    endif;
    if ( $settings['font_type_body'] = "Kreon") :
        wp_register_style('body-google-webfonts', 'http://fonts.googleapis.com/css?family=Kreon');
        wp_enqueue_style( 'body-google-webfonts');
    endif;
}

and this:

function body_google_webfonts() {
    if( $settings['font_type_body'] = "Handlee") {
        wp_register_style('body-google-webfonts', 'http://fonts.googleapis.com/css?family=Handlee');
        wp_enqueue_style( 'body-google-webfonts');
    }
    if ( $settings['font_type_body'] = "Kreon") {
        wp_register_style('body-google-webfonts', 'http://fonts.googleapis.com/css?family=Kreon');
        wp_enqueue_style( 'body-google-webfonts');
    }
}

and I’ve tried this:

function body_google_webfonts() {
    if( $settings['font_type_body'] = "Handlee") {
        wp_register_style('body-google-webfonts', 'http://fonts.googleapis.com/css?family=Handlee');
        wp_enqueue_style( 'body-google-webfonts');
  } else if ( $settings['font_type_body'] = "Kreon") {
        wp_register_style('body-google-webfonts', 'http://fonts.googleapis.com/css?family=Kreon');
        wp_enqueue_style( 'body-google-webfonts');
  }
}
  • 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-18T09:33:58+00:00Added an answer on June 18, 2026 at 9:33 am

    I think your problem is: you are not comparing two things, you are making the variable settings equal to “Handlee”.
    This operation will always return true, so just the first if will be executed.

    To solve this, use the correct sentence:

    $settings['font_type_body'] == "Handlee"
    

    With double “=”.

    @Jessica, a very good programation practice, to avoid this simple error, is always put your variable at right side of the comparation. Something like this:

    int a = 0; 
    if 0 == a 
    

    You can use it for others languages. It’s good cause, if you try to do

    If 0 = a
    

    it’s easy to find your problem in debug mode.

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

Sidebar

Related Questions

Why does this code only draw a circle once? I cannot for the life
I created the Layout design using java code only not from the XML Layout
I have the following scenario. The client code only has access to FooHandler, not
This code only renders a dodecahedron and completely ignores the glBegin(GL_TRIANGLES) block: glutSolidDodecahedron(); glBegin(GL_TRIANGLES);
I have the following code (only sections of it) for getting the entries in
[Rails] I need to run some code only 40% of the times, how may
My team is using Entity Framework 4.3.0 - Code Only with POCO classes as
I am populating a UITableViewController's UITableView through code only. At the bottom of the
How to make this css code cross browser compatible using jquery. this code only
I have a reacurring problem. I code nice standards compliant code only to have

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.