WordPress.org

Forums

Pods - Custom Content Types and Fields
[resolved] Displaying Pods by Category (7 posts)

  1. benclintz
    Member
    Posted 2 years ago #

    I am using custom post type and on the post type options, i have selected to use categories and tags. I now have a list of categories on my sidebar and i don't know how to display the data. Could anyone have an idea on how to? thanks in advance

    http://wordpress.org/extend/plugins/pods/

  2. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 2 years ago #

  3. benclintz
    Member
    Posted 2 years ago #

    i have a post pod called kenya_safaris
    and a category pod called safari_category
    i have this in my archive.php
    <?php
    $selected = pods_url_variable(-1);
    $pods= new Pod('kenya_safaris');
    $params['select'] = '*';
    $params['orderby'] = 't.name';
    $params['limit'] = 25;
    $params['where'] = 'category.name LIKE "'.$selected.'"';
    echo $pods->find( $params )->template( 'Safari_Template' );
    ?>
    is there anything that i am doing wrong? coz i cant display post per category

  4. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 2 years ago #

    Use the WordPress API and templating structure, it's the easiest way to theme.

    See: http://codex.wordpress.org/Creating_an_Archive_Index#The_Template_.28archives.php.29

  5. benclintz
    Member
    Posted 2 years ago #

    Hey Scott Thanks for your help, I actually noticed that my problem was displaying custom fields in archive pages. I have managed to display the title and summary but i am having some problems with the image. My code in archive.php loop is:

    <h4 class="excerpt-title"><a>"><?php echo get_the_title(); ?> </a></h4>
     <?php $postimageurl = get_post_meta($post->ID, 'tiny_pic', true);
    if ($postimageurl) {
    ?>
          <a>" rel="bookmark"><img src="<?php echo $postimageurl; ?>" alt="Post Pic"  class="tinyPic " width="150" height="150" /></a>
    <?php } else { ?>
          <a>" rel="bookmark"><img src="<?php bloginfo('template_url'); ?>/images/wprecipes.gif" class="tinyPic" alt="Screenshot" width="150" height="150" /></a>
    <?php } ?>
    <div id="summary"><?php echo get_post_meta($post->ID, 'summary', true); ?></div>
        <div id="readmore"><a>">Read More</a></div>

    My image is in a custom field pod
    I only have the image frame but it is not displaying the image. Pliz assist on this.

  6. Scott Kingsley Clark
    Member
    Plugin Author

    Posted 2 years ago #

    You could try using this instead when you output it:

    <?php echo pods_image_url( $postimageurl, 'thumbnail' ); ?>

  7. benclintz
    Member
    Posted 2 years ago #

    Thanks Scott it worked!!

Topic Closed

This topic has been closed to new replies.

About this Plugin

About this Topic

Tags

No tags yet.