WordPress.org

Ready to get started?Download WordPress

Forums

[resolved] Multiple loop, custom field and WP Alchemy (6 posts)

  1. daztayor
    Member
    Posted 3 years ago #

    Hi, I have a page with multiple loops. I can pull the page information from the content/title etc on querying the template. It also pulls the custom field, however it only pulls 1 custom field. ie there are 3 separate pages each with there own custom field entry but it is only pulling the last entry.
    Here is the site (its the scroller at the bottom of the page)
    http://languagetest.preview4.co.uk/
    And the code

    <?php query_posts(array(
    			   	'post_type' => 'page',
    			    'posts_per_page' => 4,
    			    'meta_value' => 'page-with-added-intro.php',
    			)); ?>
    
      <?php while (have_posts()) : the_post(); ?>
    
        <li class="leadin">
                <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>"><?php the_title(); ?></a></h3>
    
                      	<div class="inner">
                      		<?php echo get_the_post_thumbnail($page->ID, 'thumbnail'); ?>
    
                            <p><?php echo $custom_text_mb->the_value('addtional_text'); ?></p>
    
                		</div>
    
                <a class="view" href="<?php the_permalink() ?>" rel="bookmark" title="Permanent Link to <?php the_title_attribute(); ?>">Find out more</a>		
    
    			</li>
    
      <?php endwhile;?>

    Any ideas? Many thanks

  2. farinspace
    Member
    Posted 3 years ago #

    try the following:

    <?php while (have_posts()) : the_post(); $custom_text_mb->the_meta(); ?>

  3. daztayor
    Member
    Posted 3 years ago #

    Great stuff thank you. Great class by the way has really streamlined the way we work!

  4. daztayor
    Member
    Posted 3 years ago #

    Hi Dimas I've another question.
    I've imported xls file data into the post table no problem.
    When I then import a second set of data into the postmeta table to populate the custom fields designed by WPAlchemy meta boxes, unfortunately nothing displays. They appear fine in the postmeta table but don't show in the admin or the frontend. They are assigned a post_id correctly. They also appear fine on the posts where I have manually entered data.
    Any ideas, is this a wp or mysql issue? I've 200 pages to import each with 40 data entries to input.
    Many thanks again for a great plugin.

  5. daztayor
    Member
    Posted 3 years ago #


  6. daztayor
    Member
    Posted 3 years ago #

    Ok I've worked it out, you need to add the connection meta_key which comes in the form of _your_custom_meta_id_field and whatever the meta_value code it spits out when you do the first one manually. ie

    a:34:{i:0;s:7:"_XXX_ID";i:1;s:17:"_XX etc..

    Will be the same for all instances

    Crackin

Topic Closed

This topic has been closed to new replies.

About this Topic