WordPress.org

Support

Support » Plugins and Hacks » Magic Fields » Duplicate group returns image as Array

Duplicate group returns image as Array

  • Below is my code, everything else works fine except the image. It returns “Array”.

    $profiles = get_group('Teacher');
    		    foreach($profiles as $profile){
    		    	echo "<div class=\"side-er teacher fl-left\">";
    				echo "".$profile['teacher_image'][1]."";
    		    	echo "</div>";
    		    	echo "<div class=\"full-content fl-right\">";
    		    	echo "<h2>".$profile['teacher_full_name'][1]."</h2>";
    		    	echo "<p>".$profile['teacher_content'][1]."</p>";
    		    	echo "<p>Contact Details:<br />";
    		    	echo "Cell: ".$profile['teacher_cell'][1]."<br />";
    		    	echo "Email: <a href=\"".$profile['teacher_email'][1]."\">".$profile['teacher_email'][1]."</a></p>";
    		    	echo "</div>";
    		    	echo "<div class=\"clear-fix\"></div>";
    		    }

    If I call get('teacher_image'); The images shows but only the first groups image on all groups.

    Any suggestions?

    http://wordpress.org/extend/plugins/magic-fields/

Viewing 1 replies (of 1 total)
  • Okay so I found the answer. After $profiles = get_group('Teacher'); insert pr($profiles);. It will then return a whole bunch of code and feed you back with “pre” text. It then shows you the array of types for your image. You then select which ever one and insert it into your code. Remeber to remove the pr($profiles)

    Below is a snippet of the complete working code:

    $profiles = get_group('Teacher');
    		    foreach($profiles as $profile){
    		    	echo "<div class=\"side-er teacher fl-left\">";
    		    	echo "".$profile['teacher_image'][1]['src']."";
    		    	echo "</div>";
    		    	echo "<div class=\"full-content fl-right\">";
    		    	echo "<h2>".$profile['teacher_full_name'][1]."</h2>";
    		    	echo "<p>".$profile['teacher_content'][1]."</p>";
    		    	echo "<p>Contact Details:<br />";
    		    	echo "Cell: ".$profile['teacher_cell'][1]."<br />";
    		    	echo "Email: <a href=\"".$profile['teacher_email'][1]."\">".$profile['teacher_email'][1]."</a></p>";
    		    	echo "</div>";
    		    	echo "<div class=\"clear-fix\"></div>";
    		    }

Viewing 1 replies (of 1 total)
  • The topic ‘Duplicate group returns image as Array’ is closed to new replies.
Skip to toolbar