Ready to get started?Download WordPress


How can i get the title (4 posts)

  1. TataVostru
    Posted 1 year ago #

    how can i get the title link not the id

    Custom field : locul_2

    $locul_2_value = get_post_meta($post->ID, 'locul_2', true);
    // check if the custum field has a value
    if($locul_2_value != '') {
      echo $locul_2_value;
  2. dkryzaniak
    Posted 1 year ago #


    Source: http://codex.wordpress.org/Function_Reference/get_the_title

    Let me know if that is what you are looking for!

    [ Signature moderated. Would you please stop doing that? ]

  3. TataVostru
    Posted 1 year ago #

    no this is not, i want to retrive the title from post's

    This i want(please look at the pictures):

    Hy im not familiar so good with php code,i'm building a cinema site, im stuck in Box-office

    EX: http://cinema.trancelevel.com/box-office/1-iulie-7-iulie-2012/

    The Movies are stored in Posts :

    The Box-office are post_type:

    How can i link to display the post into post type...?

    Now in Box-Office i have post_type with the field locul_1, locul_2... and so on

    In each other i add a movie that i want to be display in Box Office Theme

    Template Name Posts: Pagina Box-Office RO
    <?php include (TEMPLATEPATH . '/header/index-trailer.php'); ?>
    <div class="art-contentLayout">
    <div class="breadcrumbs">
        <?php if(function_exists('bcn_display'))
    <div class="art-content">
    <?php if (have_posts()) : while (have_posts()) : the_post(); ?>
    <div class="box-film">
    <h2 class="titlu-film">
    <a>" rel="bookmark" title="<?php printf(__('%s'), the_title_attribute('echo=0')); ?>"><?php the_title(); ?></a>
    <div class="art-Post">
        <div class="art-Post-tl"></div>
        <div class="art-Post-tr"></div>
        <div class="art-Post-bl"></div>
        <div class="art-Post-br"></div>
        <div class="art-Post-tc"></div>
        <div class="art-Post-bc"></div>
        <div class="art-Post-cl"></div>
        <div class="art-Post-cr"></div>
        <div class="art-Post-cc"></div>
        <div class="art-Post-body">
    <table class="tabel-box" border="0" cellpadding="1">
        <td class="tabel-img" rowspan="3"><img src="/scripts/timthumb.php?src=<?php the_field('img'); ?>&h=120&w=90&zc=1" alt="<?php the_title(); ?>"  title="<?php the_title(); ?>"/>
        <td class="tabel-numar">1</td>
        <td class="tabel-titlu" colspan="5"></td>
        <td  class="tabel-numar-s"rowspan="2"></td>
        <td class="tabel-gen">Gen film</td>
        <td class="tabel-st">Saptamana trecuta</td>
        <td class="tabel-iw">Incasari Weekend</td>
        <td class="tabel-t">Vezi trailer</td>
        <td class="tabel-link">Action, adventure</td>
        <td class="tabel-link"><?php $key="incasari_weekend"; echo get_post_meta($post->ID, $key, true); ?></td>
        <td class="tabel-link"><?php $key="incasari_totale"; echo get_post_meta($post->ID, $key, true); ?></td>
        <td class="tabel-link"> </td>
    <?php endwhile; ?>
    <?php else: ?>
    <h2 class="center"><?php _e('Sorry, no posts matched your criteria.', 'kubrick'); ?></h2>
    <?php endif; ?>
    <?php include (TEMPLATEPATH . '/sidebar1.php'); ?>
    <div class="cleared"></div>
    <?php get_footer(); ?>
  4. TataVostru
    Posted 1 year ago #

    This code get me the movies... but it give mee all the movies stored in post

    //create new loop query for films by this actor
    $movies = $wpdb->get_col("SELECT post_id FROM $wpdb->postmeta WHERE meta_key = 'img' AND meta_value LIKE '%".get_the_ID()."%'");
    $the_query = new WP_Query( array( 'post__in' => $movies) );
    // The Loop
    while ( $the_query->have_posts() ) : $the_query->the_post();
    	echo '<div class="actor-box-related"><a class="actor-titlu" href="';
    	echo '" title="'.get_the_title().'">';
        <img class="actor-img" src="/scripts/timthumb.php?src=<?php the_field('img'); ?>&h=90&w=60&zc=1" alt="<?php the_title(); ?>"  title="<?php the_title(); ?>"/>
        <?php the_title();
    	echo '</a></div>';
    // Reset Post Data

    ( this code is for link-ing the actors that play in that movie.).

    I want to retrive the movies.. (please see the link below)
    and display each under.

    Do you understant wath i want?

Topic Closed

This topic has been closed to new replies.

About this Topic