Results 1 to 3 of 3

Thread: Classipress on MultiSite - Display posts from specific category

  1. #1
    Thread Starter
    Junior Member cgervereau's Avatar
    Join Date
    Jul 2010
    Location
    Morocco
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Classipress on MultiSite - Display posts from specific category

    Hello,

    I tried to load on my blog (root) a selection of posts from a specific category in my other classified blog.
    Before the 3.05 version that was very easy with this code :

    I just loaded the 'category_name=iphone' with this code

    Code:
    global $switched;
    switch_to_blog(3);    
    $my_query = new WP_Query('category_name=iphone');
    while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate[$post->ID] = $post->ID;
    
    ....etc
    But with the new release and the taxonomy terms it is very difficult. I tried this but I don't know how and where to send the slug "iphone"

    Code:
    global $switched;
    switch_to_blog(3);
    $term = get_term_by('slug', get_query_var('term'), get_query_var('taxonomy'));
    $my_query = new WP_Query(array('post_type' => 'ad_listing', 'post_status' => 'publish','ad_cat' => $term->slug, 'showposts' => 20, 'orderby' => 'rand'));
    while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate[$post->ID] = $post->ID;
    I tried to add directly the ad_cat like this :
    Code:
    $my_query = new WP_Query(array('post_type' => 'ad_listing', 'post_status' => 'publish','ad_cat' => 'iphone', 'showposts' => 20, 'orderby' => 'rand'));
    while ($my_query->have_posts()) : $my_query->the_post(); $do_not_duplicate[$post->ID] = $post->ID;
    but it doesn't work....

    Could you help me ?

  2. #2
    jomarkosabel's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    40,958
    Thanks
    169
    Thanked 3,405 Times in 3,276 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    Please help our moderating team work more efficiently by not sending us support questions via PM. You can read more about how AppThemes support works here. However, you can send a PM to follow up and remind me if I missed your support request/thread.

    Thank you and have a nice day.

  3. #3
    Thread Starter
    Junior Member cgervereau's Avatar
    Join Date
    Jul 2010
    Location
    Morocco
    Posts
    26
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Display Ads from a selected Sub Category (Tag)

    You must be an AppThemes customer and logged in to view this response. Join today!

Thread Information

Users Browsing this Thread

There are currently 1 users browsing this thread. (0 members and 1 guests)

Similar Threads

  1. Display specific sub-category on home page
    By dmjendor in forum ClassiPress General Discussion
    Replies: 2
    Last Post: January 11th, 2011, 01:16 PM
  2. Display featured on different blog - multisite setup
    By techbroker in forum ClassiPress General Discussion
    Replies: 3
    Last Post: October 21st, 2010, 09:17 AM
  3. Replies: 1
    Last Post: August 3rd, 2010, 04:09 AM