Forum Replies Created

Viewing 10 replies - 1 through 10 (of 10 total)
  • Xerotones code works perfect! How is it possible to get an array with all the tax-terms which are matching the original post’s terms into the result object?

    The object foreach related post looks like this:

    stdClass Object
    (
        [object_id] => 458
        [matches] => 4
    )

    and I’d like it to look like this:

    stdClass Object
    (
        [object_id] => 458
        [matches] => 4
    	[matching_terms] => Array(
    							[0] => 146
    							[1] => 155
    							[2] => 190
    							[3] => 213
    						)
    )

    Can this be done? Thank You for help!

    Thread Starter rogersabboes

    (@rogersabboes)

    This issue has been resolved here: http://wordpress.org/support/topic/423280?replies=8

    Thread Starter rogersabboes

    (@rogersabboes)

    This is absolute perfect! It just works when merging the args!

    I think adding a specific tag to to the query arguments would’nt help in my case, because the function is supposed to get the arguments automatically, depending on which site the user navigates to.

    Thanks all a lot for solving my problem!

    Thread Starter rogersabboes

    (@rogersabboes)

    Actually I want to have a list of categories in the sidebar of my theme. Only those categories should show up in the list which are assigned to the posts shown in the loop.
    So lets say I navigate to main page where all posts show up, the category-list would list all categories. When I navigate to a tag-archive (?tag=anything), the category list should only show those categories which are assigned to the posts in this specific tag-archive. And so on..
    I use this function for it in the sidebar:

    $cat_array = array();
    $args=array(
    'posts_per_page' => '-1');
    $currentposts = new WP_Query($args);
       foreach($currentposts->posts as $currentposts->post) {
        foreach(get_the_category($currentposts->post->ID) as $category) {
          $cat_array[$category->term_id] =  $category->term_id;
        }
      }
    
    $cat_ids = implode(',', $cat_array);
    wp_list_categories('include='.$cat_ids.'&title_li=Author Categories&show_count=1');

    When I use $currentposts = $wp_query; instead of the new WP_query, everything works perfect, except that global $wp_query onyl considers a maximum of 10 posts, as this is the number i set at the WP reading settings.

    Thread Starter rogersabboes

    (@rogersabboes)

    Yes thanks esmi, this one solves the problem partly. I’m getting now all the posts instead of only ten.
    It looks like so:

    $args=array(
    'posts_per_page' => '-1');
    $currentposts = new WP_Query($args);

    But still the query ignores the querystring from the current url. The result of the query is static, it retrieves all the posts all the time, no matter if the current page is for instance http://www.root.net or http://www.root.net?tag=anything .
    So I need somehow make the new WP_Query consider the global $query_string (like for instance: ?tag=anything), just the way like the global wp_query would do it.

    Thread Starter rogersabboes

    (@rogersabboes)

    Ok I found a solution doing the trick by modifying a function by MichaelH (http://wordpress.org/support/topic/327333?replies=34).

    $cat_array = array();
     foreach($posts as $post) {
      foreach(get_the_category($post->ID) as $category) {
        $cat_array[$category->term_id] =  $category->term_id;
      }
    }
    $cat_ids = implode(',', $cat_array);
    wp_list_categories('include='.$cat_ids.'&title_li=Categories in the current loop');

    This function shows a list of all categories included in those posts which are currently shown within the loop. When I put it f.i. in my sidebar i can see all the categories from my current query, no matter if I’m on an archive-page, a query-page or on the index-page.

    This function works only for categories. How do I change it that it also lists custom taxonomy-tags, and probably also ‘Tag-tags’ and custom field-values which are currently shown in posts from the loop?

    Another problem I have with this function is that the list ignores categories which are not listed on the first page. For example when I have an archive-page with 15 posts and the first ten are shown at ?cat=22 and the remaining 5 on ?cat=22&paged=2, I will get 2 different results in the category list, including only those categories which are on the specific page. Is there an option to get always the same list, no matter if the posts are on more than one page?
    Thanks a lot!

    rogersabboes

    (@rogersabboes)

    works perfect now! thanks a lot!

    rogersabboes

    (@rogersabboes)

    thx, I’ll give it a try and let you know!

    rogersabboes

    (@rogersabboes)

    Here’s the link to the website: website
    Heres the ics: ics
    Thanks!

    rogersabboes

    (@rogersabboes)

    I have the same problem as poidokan does. Funny thing is: everything worked just fine for me in the past (i use the plugin for one month), the previous events showed up perfectly. The warning message started to appear a day ago although I didn’t change anything on the plugin or it’s configuration. So probably it has something to do with PHP. My server runs version 5.2.13.

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