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

  • Home
  • SEARCH
  • 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 6338215
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 24, 20262026-05-24T19:23:58+00:00 2026-05-24T19:23:58+00:00

working on a highly complex WordPress theme that features many different custom post types

  • 0

working on a highly complex WordPress theme that features many different custom post types. I was under the impression that the following code would check to see if the current post was of the type “philosopher” and then run the PHP conditional that follows it only if the post is in that type:

<?php if (get_post_type() == 'philosopher') { ?>

Unfortunately, my expectation was that to make the same item conditional for “philosopher”, “text”, and “original” my code should look like this:

<?php if (get_post_type() == 'philosopher','text','original') { ?>

But alas, I was wrong. I did get the following code to work, but I’m wondering if there’s a cleaner way to do this (or if I’m somehow missing something)

        <?php if ( (get_post_type() == 'philosimply') || (get_post_type() == 'text') || (get_post_type() == 'original'))  { ?>
  • 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-24T19:23:59+00:00Added an answer on May 24, 2026 at 7:23 pm
    if ( in_array(get_post_type(), array('philosopher','text','original')) ){ ... }
    

    http://www.php.net/manual/en/function.in-array.php

    Is that, what you are looking for?

    HTH

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

Sidebar

Related Questions

I am working on this PHP project and I have many places that an
i am in big dilema.. I am working on highly modular web app in
I am working on writing a Highly Available agent for JBoss Application Server to
Working with a SqlCommand in C# I've created a query that contains a IN
Working on a somewhat complex page for configuring customers at work. The setup is
Working on a project that parses a log of events, and then updates a
I'm working on a piece of code in C# / XNA where I'm highly
I'm working on an application that I will soon be publicly distributing. I would
I'm currently working on a large, highly trafficked Ruby on Rails website and in
I have this working regex (tested on regex coach): \n[\s]*[0-9]*[\s]*[0-9]*(\.)?[0-9]*(e\+)?[0-9]* that is supposed to

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.