Search Results

Search found 4 results on 1 pages for 'nordin'.

Page 1/1 | 1 

  • Wordpress - related posts by custom taxonomy problem

    - by Nordin
    Hello, I'm trying to display related posts based on a custum taxonomy. I found a query at wordpress.org that kind of works. However the original post gets duplicated in the results multiple times. (words is the name of the custom taxonomy I use) What seems to happen is that the single post gets duplicated according to what amount showpost is set. Any idea's what could cause this? The code: <?php //for in the loop, display all "content", regardless of post_type, //that have the same custom taxonomy (e.g. words) terms as the current post $backup = $post; // backup the current object $found_none = '<h2>No related posts found!</h2>'; $taxonomy = 'words';// e.g. post_tag, category, custom taxonomy $param_type = 'words'; // e.g. tag__in, category__in, but genre__in will NOT work $post_types = get_post_types( array('public' => true), 'names' ); $tax_args=array('orderby' => 'none'); $tags = wp_get_post_terms( $post->ID , $taxonomy, $tax_args); if ($tags) { foreach ($tags as $tag) { $args=array( "$param_type" => $tag->slug, 'post__not_in' => array($post->ID), 'post_type' => $post_types, 'showposts'=>5, 'caller_get_posts'=>1 ); $my_query = null; $my_query = new WP_Query($args); if( $my_query->have_posts() ) { while ($my_query->have_posts()) : $my_query->the_post(); ?> <h3><a href="<?php the_permalink() ?>" rel="bookmark" title="<?php the_title(); ?>"><?php the_title(); ?></a></h3> <?php $found_none = ''; endwhile; } } } if ($found_none) { echo $found_none; } $post = $backup; // copy it back wp_reset_query(); // to use the original query again ?>

    Read the article

  • Exclude category from custom taxonomy output

    - by Nordin
    Hello, I'm using the query below to output all links from a custom taxonomy. It outputs all posts that are tagged 'http' from the taxonomy 'words'. I would like to exclude some general categories from the output. So, fe. it only outputs links in the media and news categories. What would be the best way to achieve this. $wp_query->request = " SELECT DISTINCT * FROM $wpdb->posts LEFT JOIN $wpdb->term_relationships ON($wpdb->posts.ID = $wpdb->term_relationships.object_id) LEFT JOIN $wpdb->term_taxonomy ON($wpdb->term_relationships.term_taxonomy_id = $wpdb->term_taxonomy.term_taxonomy_id) LEFT JOIN $wpdb->terms ON($wpdb->term_taxonomy.term_id = $wpdb->terms.term_id) WHERE $wpdb->posts.post_type = 'post' AND $wpdb->posts.post_status = 'publish' AND $wpdb->term_taxonomy.taxonomy = 'words' AND $wpdb->terms.slug = 'http' ORDER BY $wpdb->posts.post_date DESC LIMIT $ppp OFFSET $offset"; $pagelinkposts = $wpdb->get_results($wp_query->request, OBJECT);

    Read the article

  • How to limit the wordpress tagcloud by date?

    - by Nordin
    Hello, I've been searching for quite a while now to find a way to limit wordpress tags by date and order them by the amount of times they appeared in the selected timeframe. But I've been rather unsuccesful. What I'm trying to achieve is something like the trending topics on Twitter. But in this case, 'trending tags'. By default the wordpress tagcloud displays the most popular tags of all time. Which makes no sense in my case, since I want to track current trends. Ideally it would be something like: Most popular tags of today Obama (18 mentions) New York (15 mentions) Iron Man (11 mentions) Robin Hood (7 mentions) And then multiplied for 'most popular this week' and 'most popular this month'. Does anyone know of a way to achieve this?

    Read the article

  • python regex for repeating string

    - by Lars Nordin
    I am wanting to verify and then parse this string (in quotes): string = "start: c12354, c3456, 34526;" //Note that some codes begin with 'c' I would like to verify that the string starts with 'start:' and ends with ';' Afterward, I would like to have a regex parse out the strings. I tried the following python re code: regx = r"V1 OIDs: (c?[0-9]+,?)+;" reg = re.compile(regx) matched = reg.search(string) print ' matched.groups()', matched.groups() I have tried different variations but I can either get the first or the last code but not a list of all three. Or should I abandon using a regex?

    Read the article

1