SitePoint Sponsor

User Tag List

Results 1 to 8 of 8
  1. #1
    SitePoint Enthusiast fatihturan's Avatar
    Join Date
    Aug 2008
    Location
    Turkey
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)

    Exclamation Wordpress Problem: Strange Problem on My Gallery Loop

    Hi.

    I created a trailer gallery page with regular wordpress loop but there are some strange problems.

    If you can look line 22 at my template's codes you will see showposts=16 parameter to just show 16 post per page.

    But now it's showing first gallery page with 14 post (14 item) second page will be showing 16, then next showing something different.

    So there are a problem which i can't solve. How i can solve this problem?

    Thanks.
    Web & User Interface Designer Co-Founder at Unicrow

  2. #2
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Do you have posts where the "fragman" meta attribute is not true or the post has no gallery images attached? Just because it pulls 16 posts from the database doesn't mean they all pass the conditions you're testing before outputting an image. You can check the size of the result set to confirm (try globaling $wpdb, should be in that object somewhere, or counting how many times the loop iterates).

  3. #3
    SitePoint Enthusiast fatihturan's Avatar
    Join Date
    Aug 2008
    Location
    Turkey
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Do you have posts where the "fragman" meta attribute is not true or the post has no gallery images attached?
    Yes, i have some post without "fragman" meta.

    Why it doesn't pass the conditions?

    You can check the size of the result set to confirm (try globaling $wpdb, should be in that object somewhere, or counting how many times the loop iterates).
    How i can do that? My PHP knowledge isn't enough. Can you help me?
    Web & User Interface Designer Co-Founder at Unicrow

  4. #4
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by fatihturan View Post
    Yes, i have some post without "fragman" meta.

    Why it doesn't pass the conditions?
    Here's your code:

    Code:
    <?php $fragmanSource = get_post_meta($post->ID, "fragman", true); ?>   
    <?php $post_images = post_gallery_get_images(); ?>
    <?php $total_images = sizeof($post_images); ?>
    <?php if ($fragmanSource != "" && $total_images > 0) : ?>
    It says display the image if this "fragman" attribute is non-empty and there are gallery images. So you retrieve 16 posts from the database, and if any of them have an empty "fragman" attribute, no images are displayed for that post, resulting in less than 16 on the page.

  5. #5
    SitePoint Enthusiast fatihturan's Avatar
    Join Date
    Aug 2008
    Location
    Turkey
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dan Grossman View Post
    Here's your code:

    Code:
    <?php $fragmanSource = get_post_meta($post->ID, "fragman", true); ?>   
    <?php $post_images = post_gallery_get_images(); ?>
    <?php $total_images = sizeof($post_images); ?>
    <?php if ($fragmanSource != "" && $total_images > 0) : ?>
    It says display the image if this "fragman" attribute is non-empty and there are gallery images. So you retrieve 16 posts from the database, and if any of them have an empty "fragman" attribute, no images are displayed for that post, resulting in less than 16 on the page.
    Ok, i understand this.

    But how i can pass this conditions? Do you have any idea or sample?
    Web & User Interface Designer Co-Founder at Unicrow

  6. #6
    Follow Me On Twitter: @djg gold trophysilver trophybronze trophy Dan Grossman's Avatar
    Join Date
    Aug 2000
    Location
    Philadephia, PA
    Posts
    20,580
    Mentioned
    1 Post(s)
    Tagged
    0 Thread(s)
    This isn't standard WordPress stuff, it's theme specific stuff, you need to figure out how your theme works.

  7. #7
    SitePoint Enthusiast fatihturan's Avatar
    Join Date
    Aug 2008
    Location
    Turkey
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Quote Originally Posted by Dan Grossman View Post
    This isn't standard WordPress stuff, it's theme specific stuff, you need to figure out how your theme works.
    Ok. I will try to figure out how my theme works.

    --

    First, i'm including trailer movie URL with Wordpress's custom key fields on normal posts (which showing on homepage -index.php-).

    Second, i created a Wordpress loop on Gallery template. I'm trying to display which have 'fragman' meta key on normal posts.

    That's it.

    Sorry for my bad English.
    Web & User Interface Designer Co-Founder at Unicrow

  8. #8
    SitePoint Enthusiast fatihturan's Avatar
    Join Date
    Aug 2008
    Location
    Turkey
    Posts
    26
    Mentioned
    0 Post(s)
    Tagged
    0 Thread(s)
    Up... Anyone can solve my problem?
    Web & User Interface Designer Co-Founder at Unicrow


Tags for this Thread

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •