Results 1 to 5 of 5

Thread: Related Ads using hooks (functions.php) in child theme

  1. #1
    Thread Starter
    Junior Member plink's Avatar
    Join Date
    May 2011
    Location
    Australia
    Posts
    37
    Thanks
    2
    Thanked 1 Time in 1 Post

    Related Ads using hooks (functions.php) in child theme

    Hi members,

    I'm using conseo's tutorial http://forums.appthemes.com/show-rel...ategory-23244/ to create related ads through functions.php and app themes action hooks inside a child theme. I am trying to eliminate as many changes as possible every time there is a new classipress update. So far I have the following code which works, but I am having trouble with css to align the related ads.

    PHP Code:
    function related_ads() { 

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

    $sql = "SELECT term_id, slug FROM `wp_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_TYPE, APP_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; 



    }
    add_action'appthemes_after_endwhile''related_ads' );
    Any help would be greatly appreciated

    Screen Shot 2012-05-03 at 6.26.05 PM.png

  2. #2
    Veteran hugo's Avatar
    Join Date
    Aug 2010
    Location
    United Kingdom
    Posts
    310
    Thanks
    13
    Thanked 80 Times in 54 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!
    My Classipress Suggestion: http://ideas.appthemes.com/forums/84...ents?ref=title vote if you like!

  3. #3
    Thread Starter
    Junior Member plink's Avatar
    Join Date
    May 2011
    Location
    Australia
    Posts
    37
    Thanks
    2
    Thanked 1 Time in 1 Post
    You must be an AppThemes customer and logged in to view this response. Join today!

  4. #4
    Veteran hugo's Avatar
    Join Date
    Aug 2010
    Location
    United Kingdom
    Posts
    310
    Thanks
    13
    Thanked 80 Times in 54 Posts
    You must be an AppThemes customer and logged in to view this response. Join today!

  5. #5
    Thread Starter
    Junior Member plink's Avatar
    Join Date
    May 2011
    Location
    Australia
    Posts
    37
    Thanks
    2
    Thanked 1 Time in 1 Post
    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. [TUTORIAL] Child Theme : Unhook ( remove hook ) default appthemes functions
    By amine0272 in forum ClassiPress General Discussion
    Replies: 9
    Last Post: August 6th, 2013, 02:42 PM
  2. Using hooks to change functions or remove them
    By coza in forum JobRoller General Discussion
    Replies: 3
    Last Post: February 14th, 2012, 04:29 AM
  3. [SOLVED] Hooks and Child Theme in Wordpress 3.3.1 and Classipress 3.1.6/3.1.7
    By laura in forum Report ClassiPress Bugs
    Replies: 12
    Last Post: January 30th, 2012, 03:30 PM
  4. child theme - functions - theme actions
    By pauro in forum Report ClassiPress Bugs
    Replies: 5
    Last Post: January 3rd, 2012, 06:56 AM
  5. Child theme - custom functions - mapping cp_login_head
    By rodeoramsey in forum Report ClassiPress Bugs
    Replies: 6
    Last Post: August 29th, 2010, 03:30 PM