Forum Replies Created

Viewing 6 replies - 1 through 6 (of 6 total)
  • Needed to change image size for thumbnail and wrote some og meta tags, now it works ??

    I found a way to exclude categories, it’s kind of a work around but it works. First I run a counter. Then I set the limit a lot higher than the limit i want (40), then i put in a continue statement if it’s the caregory i want to exclude. If the counter is at the limit i really want(10), i put in the break statement. It works perfectly.

    Here’s my code:

    <!--most populair posts-->
    <?php $count = 1; //setting the counter
    
    $posts = wmp_get_popular( array( 'limit' => 40, 'post_type' => 'post', 'range' => 'monthly' ) ); //setting a higher limit
    global $post;
    if ( count( $posts ) > 0 ): foreach ( $posts as $post ):
    setup_postdata( $post );
    
    if ( in_category( 'exclude_this_category' )) { continue; } ?><!--exclude the unwanted category-->
    
    <a href="<?php the_permalink() ?>" title="<?php echo esc_attr(get_the_title() ? get_the_title() : get_the_ID()); ?>"><?php if ( get_the_title() ) the_title(); else the_ID(); ?></a>
    
    <?php $count++; //add 1 to the counter
    if ($count == 11) {break;} //break when i have run the loop 10 times
    endforeach; endif;?>
    <!--most populair posts-->

    Hope this helps

    I have the same problem, the wrong image is shared, not the featured image, but one from the sidebar

    Thread Starter sannevanschie

    (@sannevanschie)

    Yes, I solved it like this:

    before the loop I check the current category

    <?php $category = get_the_category(); ?>

    Then in the loop I check if it’s a category page, if so, if the post is the same category as the current one i continue

    <?php if (is_category()) {
    if (in_category( $category[0]->cat_name )) { continue; }} ?>

    thanks

    Thread Starter sannevanschie

    (@sannevanschie)

    I can’t because it’s a password protected site at the moment.

    I mean if someone wants to see al the posts for instance from category 6 ,these posts are normaly displayed in the right column but now the category displays them aswell in the left column and i don’t want that.

    like this:

    left – right
    1,2,3 – 4,5,6

    someone clicks 6 and it’s like this:
    6 – 4,5,6

    but i want:
    6 – 4,5 (and not 6)

    I hope this is understandable, sorry i can’t send a link…

    Thread Starter sannevanschie

    (@sannevanschie)

    yes, i acctually have two columns (loops) with posts, the left one displays of instance posts with category id’s 1, 2, 3, the right displays 4, 5 and 6

    but when someone clicks on a category, they are displayed in the left column (loop) so i then want to prevent them from displaying in the right also.

Viewing 6 replies - 1 through 6 (of 6 total)