Viewing 16 post (of 16 total)
  • Author
    Posts
  • #10099
    Rattus
    Keymaster

    I’ve rewrote some code in your functions.php, because it was completely wrong and now you’ll get the right direction to complete it:

    function gmedia_albums_func() {
    	 global $wpdb, $gmDB;
    
    	 $categories = $gmDB->get_terms('gmedia_category');
        // $appTable = $wpdb->prefix . "gmedia_term";
        // $query = $wpdb->prepare("SELECT * FROM $appTable WHERE taxonomy = 'gmedia_category'");
        // $categories = $wpdb->get_results($query);
    
        foreach ( $categories as $category ) {
    		echo '<div class="col-xs-12 col-md-12 col-sm-12 categories_title wpb_content_element "><h4> '.$category->name.'</h4></div>';
    		$albums_with_category_meta = $wpdb->get_col($wpdb->prepare("SELECT gmedia_term_id FROM {$wpdb->prefix}gmedia_term_meta WHERE meta_key = 'category' AND meta_value = %d", $category->term_id));
    		if(!empty($albums_with_category_meta)){
    			$albums_cat = $gmDB->get_terms('gmedia_album', array(
    				'include' => $albums_with_category_meta
    			));
    		} else {
    			$albums_cat = array();
    		}
    		
    		// $albums = $wpdb->prepare("SELECT * FROM $appTable WHERE status = '".$category->term_id."'");
            // $albums_cat = $wpdb->get_results($albums);
    		foreach($albums_cat as  $application){
    	
            	echo '<div class="col-xs-12 col-md-3 col-sm-4 album_title wpb_content_element '.$category->name.'">
    <a href="gallery/?id='. $application->term_id .'&category_name='.$category->name.'"><h5>'. $application->name . "</h5></a></div>";
       		}
       }
    ...
    ...
    ...
Viewing 16 post (of 16 total)
  • The forum ‘Gmedia Gallery WordPress Plugin’ is closed to new topics and replies.
Forum closed. Use forum at Wordpress.org: Gmedia Support Forum