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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 15, 20262026-05-15T00:01:20+00:00 2026-05-15T00:01:20+00:00

I am calling a bunch of posts under a certain post type in WordPress

  • 0

I am calling a bunch of posts under a certain post type in WordPress which works but I am trying to add a conditional that will check first if those post’s custom meta field (labeled “disc”) is equal to the current post’s title.

Here is what I have but this conditional does not seem to work:

<?php
   $pages = get_posts('numberposts=9999&post_type=song&post_status=publish&order=ASC&orderby=date');

   $i = 1;
   foreach( $pages as $page ) {
       $content = $page->post_title;
       if( empty($content) ) continue;

       $content = apply_filters('the_content', $content); ?>

       <?php if(get_post_meta($page->ID, "p30-disc", true)=="the_title()") { ?>

       <tbody class="vevent">

       <?php if ($i%2===0) { ?><tr class="gigpress-row gigpress-alt">

       <?php } else { ?><tr class="gigpress-row"><?php } ?>

       <td><?php echo $page->post_title ?></td>
        <td><?php echo get_post_meta($page->ID, "p30-length", true); ?></td>
        <td><a href="http://itunes.com/<?php echo get_post_meta($page->ID, "p30-itunes-song", true); ?>">BUY</a></td>

        </tr>

        <tr class="gigpress-info">

        <td colspan="3"><?php echo $page->post_content ?></td>

        </tr>

        </tbody>    

<?php $i++;

   } } ?>

When I simply echo “get_post_meta($page->ID, “p30-disc”, true)” or “the_title()” it spits out their proper values, which are equal, so obviously something is just wrong with that conditional.

Thanks,

Wade

  • 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-15T00:01:21+00:00Added an answer on May 15, 2026 at 12:01 am

    Turned out there is a function called get_the_title() that is used for this sort of thing. Worked perfectly.

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

Sidebar

Related Questions

Calling Html.RenderPartial(~/Views/Payments/MyControl.ascx); from a view works if MyControl.ascx is a control that directly inherits
Calling the ajax called URL works well without ajax eg. http://localhost/ci/controller/method/param_value . But using
I'm calling a service and returning a bunch of latitudes and longitudes which I'm
Calling image = Image.open(data) image.thumbnail((36,36), Image.NEAREST) will maintain the aspect ratio. But I need
I use jquery to post to an MVC controller action that returns a table
I have a simple function that animates a bunch of images by crossfading them.
I'm writing a Ruby library which has a module with a bunch of classes
I've got a view which is adding a bunch of data into a bound
I've created a for(var i in obj) in a plugin that I'm making, but
I am trying to preload a bunch of background music files. Basically i am

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.