Mugan Posted March 9, 2020 Share Posted March 9, 2020 I have a function which finds a list of companies associated with a country from a custom taxonomy. It finds their logo and creates an output which is all logos associated with a country, and the logo has a href to link to a company page. The code for this is: function countryCompanies(){ global $post; $echo = f_print(array( 'data' => 'p2p', 'type' => 'mainlogo', 'args' => array( 'connection_type' => 'client'.$_set['lang_postfix'].'_to_location'.$_set['lang_postfix'].'', 'post_type' => 'client', 'connection_id' => $post->ID, 'alternative' => "", ), )); The f_print function finds the logos, and their sizes. So the 'mainlogo' type is a pull down of the thumbnail at 200px size. What I need to do is write CSS and PHP which will display these results in a grid, 4 colums across, and as many down as results from the array. At the moment all I can get is all the results in one column. What tutorials would I need to write appropriate CSS to create this, and then is it as simple as adding the div prior to the echo of the $echo variable? Thanks Quote Link to comment Share on other sites More sharing options...
ginerjm Posted March 9, 2020 Share Posted March 9, 2020 (edited) Are you using an html table to show this? If so, please show that code. PS - naming a function to "f_print" that does more than just "printing" is a bit confusing. Edited March 9, 2020 by ginerjm Quote Link to comment Share on other sites More sharing options...
gw1500se Posted March 9, 2020 Share Posted March 9, 2020 Also does each call output a single line or all lines? You need some <tr> and <td> tags somewhere which is why ginerjm asked about the HTML code. Quote Link to comment Share on other sites More sharing options...
ginerjm Posted March 9, 2020 Share Posted March 9, 2020 Plus - that long argument string for your array seems a bit off. Too many commas? Do you have php error checking enabled to help you debug any errors? Quote Link to comment Share on other sites More sharing options...
Mugan Posted March 9, 2020 Author Share Posted March 9, 2020 Hi, Thanks for the feedback. So I am working with some original code built for the site, so the f_print naming function is some legacy naming, so its taken me a while to work out what the function was doing, as original developer didnt leave any comment either. In terms of the output, I believe it is pulling some div based CSS to create the output in a grid. Here is the code pulled from a different area of the original site where this works: <div class="inner"> <div class="row"> <div class="w6 featured"> <h2>Clients</h2> <div class="content_box clearfix"> <div class="logo_th"><a href="***link***"><img width="70" height="30" src="***source***" class="attachment-logo size-logo wp-post-image" alt="" srcset="***source*** 70w, ***source*** 300w, ***source*** 624w, ***source*** 800w" sizes="(max-width: 70px) 100vw, 70px"></a></div> <div class="logo_th"><a href="***link***"><img width="70" height="30" src="***source***" class="attachment-logo size-logo wp-post-image" alt="" srcset="***source*** 70w, ***source*** 300w, ***source*** 624w, ***source*** 800w" sizes="(max-width: 70px) 100vw, 70px"></a></div> </div> </div> </div> Unfortunately, although i've added the same div's to my echo, it had no result, so it isnt picking them up in the code when I've written it. Do I need to construct a whole new css section to instruct the echo output? thanks Quote Link to comment Share on other sites More sharing options...
ginerjm Posted March 9, 2020 Share Posted March 9, 2020 Try using plain html code instead of echo'ing everything out. And - if you didn't write the div to do all this, why bother trying to understand someone else's mindset? Write it as an html table. Much simpler. Start with a plain non-styled table and then when it is working you can customize it with some css Quote Link to comment Share on other sites More sharing options...
Recommended Posts
Join the conversation
You can post now and register later. If you have an account, sign in now to post with your account.