Page 1 of 4 123 ... LastLast
Results 1 to 10 of 33

Thread: Show related ads including images by category

  1. #1
    Thread Starter
    conseo's Avatar
    Join Date
    Aug 2011
    Location
    Denmark
    Posts
    10
    Thanks
    2
    Thanked 14 Times in 3 Posts

    Show related ads including images by category

    Hi there

    I was looking for a easy way to show related ads including images on my new Classipress site (www.udlejerbasen.dk DANISH).
    Maybe it is not the best way to do it, but here is how i did it:

    In "single-ad_listing-php" add this code where you want the related ads to show up.

    PHP Code:
    <ul>
    <?php

    $term 
    wp_get_object_terms($post->IDAPP_TAX_CAT);
    $parent $term[0]->parent;
    $parents[] = $term[0]->term_id;

    $sql "SELECT term_id, slug FROM `wp_ub_terms` WHERE term_id = $parent";
    $resultat mysql_query($sql);

    while(
    $post=mysql_fetch_array($resultat)) {
    $newslug $post['slug'];
    }

    $thePostID $wp_query->post->ID;

    $args = array( 'numberposts' => 3'orderby' => 'rand''post_type' => APP_POST_TYPEAPP_TAX_CAT => $newslug'exclude' => $thePostID);
    $rand_posts get_posts$args );
    foreach( 
    $rand_posts as $post ) : ?>
        <li><?php cp_ad_featured_thumbnail(); ?><a id="related-title" href="<?php the_permalink(); ?>"><?php the_title(); ?></a></li>
    <?php endforeach; ?>
    </ul>
    You can se an example here: http://www.udlejerbasen.dk/annonce/21m-trailerlift/

  2. The Following 12 Users Say Thank You to conseo For This Useful Post:

    aedwin (June 11th, 2012), ahikmahin (October 16th, 2011), amine0272 (December 4th, 2011), cozmuler (May 8th, 2014), echo08 (April 8th, 2014), flyway (September 18th, 2012), helmuc (May 17th, 2012), jackie2011ws (November 8th, 2011), jomarkosabel (October 15th, 2011), omar (April 5th, 2014), sauravlnp (November 11th, 2011), timchr (April 23rd, 2012)

  3. #2
    Thread Starter
    conseo's Avatar
    Join Date
    Aug 2011
    Location
    Denmark
    Posts
    10
    Thanks
    2
    Thanked 14 Times in 3 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  4. The Following User Says Thank You to conseo For This Useful Post:

    helmuc (May 17th, 2012)

  5. #3
    jomarkosabel's Avatar
    Join Date
    Mar 2009
    Location
    Philippines
    Posts
    40,978
    Thanks
    170
    Thanked 3,407 Times in 3,278 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.

  6. #4
    shopcenter's Avatar
    Join Date
    Aug 2011
    Location
    Canada
    Posts
    84
    Thanks
    5
    Thanked 2 Times in 2 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  7. #5
    Thread Starter
    conseo's Avatar
    Join Date
    Aug 2011
    Location
    Denmark
    Posts
    10
    Thanks
    2
    Thanked 14 Times in 3 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  8. #6
    Veteran barukar's Avatar
    Join Date
    Sep 2010
    Location
    Brasil, São Paulo, SP
    Posts
    6,785
    Thanks
    186
    Thanked 742 Times in 623 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    -------------------------------------------------------------------------------------------
    Projects: ClassiNoiva - Classimóveis - vocênoenem - i50 - Clube DETRAN

  9. #7
    shopcenter's Avatar
    Join Date
    Aug 2011
    Location
    Canada
    Posts
    84
    Thanks
    5
    Thanked 2 Times in 2 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  10. #8
    Thread Starter
    conseo's Avatar
    Join Date
    Aug 2011
    Location
    Denmark
    Posts
    10
    Thanks
    2
    Thanked 14 Times in 3 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  11. The Following User Says Thank You to conseo For This Useful Post:

    shopcenter (October 16th, 2011)

  12. #9
    shopcenter's Avatar
    Join Date
    Aug 2011
    Location
    Canada
    Posts
    84
    Thanks
    5
    Thanked 2 Times in 2 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  13. #10
    Marketplace Seller ahikmahin's Avatar
    Join Date
    Aug 2010
    Location
    Australia
    Posts
    504
    Thanks
    32
    Thanked 52 Times in 42 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

Page 1 of 4 123 ... LastLast

Thread Information

Users Browsing this Thread

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

Similar Threads

  1. importing ads: how to get images to show?
    By jamesweb in forum Report ClassiPress Bugs
    Replies: 7
    Last Post: September 1st, 2011, 01:01 PM
  2. Show Related ads in sidebar
    By bnt76 in forum ClassiPress General Discussion
    Replies: 1
    Last Post: January 26th, 2011, 07:35 AM
  3. No category show + 3 images
    By piplo in forum Report ClassiPress Bugs
    Replies: 3
    Last Post: December 28th, 2010, 02:34 PM
  4. Related Posts with images
    By csilva in forum ClassiPress General Discussion
    Replies: 0
    Last Post: October 27th, 2009, 10:22 PM