I'm calling a lot of posts within certain publish key in WordPress which works however i am attempting to give a conditional which will check first if individuals post's custom meta area (labeled "disc") is equivalent to the present post's title.

Here's what I've but this conditional doesn't appear to operate:

   $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 class="gigpress-info">

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



<?php $i++;

   } } ?>

After I simply echo "get_publish_meta($page->ID, "p30-disc", true)" or "the_title()" it spits out their proper values, that are equal, so clearly something is simply wrong with this conditional.



It appears like you are "estimating" the title function - basically, making it a string, when you you need to be calling it.

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

that will work?

Switched available is really a function known as get_the_title() that's employed for this kind of factor. Labored perfectly.