Solved

Using Wordpress plugin "Magic Fields" outside of the loop

Posted on 2011-03-15
4
1,287 Views
Last Modified: 2012-05-11
This might be a bit of a long-shot but I figured I'd post this question here.

I'm using a plugin called Magic Fields. It's a very powerful plugin that works similarly to custom fields but provides a lot more opportunities to customize the WP admin as a CMS.

Anyway, I have created a page where I will adding audio clips every now and then. I am planning on using the Magic Fields plugin so that all I would need to do is upload a few details, the audio file, and it would automatically populate on my page. I've created a template for my Audio page and have been trying out different things based off of the Magic Fields documentation to get it to work but haven't had any luck (so far, I've only been able to add one audio clip to my page).

Magic Fields has a wiki and a Google group - which I've looked through and still can't seem to figure out. But if they help, you can find them here.

http://groups.google.com/group/magic-fields
http://wiki.magicfields.org/doku.php

If someone has an idea of how I can do this, I would greatly appreciate it. Thanks!
0
Comment
Question by:Adam
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 3
4 Comments
 
LVL 70

Expert Comment

by:Jason C. Levine
ID: 35144390
So what have you done in the template?  The code for audio appears to be pretty straightforward.
0
 
LVL 1

Author Comment

by:Adam
ID: 35147049
Here is what I have so far:

$AudioClip = get_group("Audio Clip");

if($AudioClip){
   foreach($AudioClip as $Audio){
        echo get('audio_clip_title')."<br />"; // Clip Title
        echo get('audio_clip_description')."<br />"; // Clip Description
        echo get('audio_clip_file')."<br />";   // Clip File Name
   }
} 

Open in new window


Right now, its throwing out the details of the first audio clip twice. I'm not really much of a developer so I can't seem to figure out what I'm doing wrong.
0
 
LVL 1

Accepted Solution

by:
Adam earned 0 total points
ID: 35167785
I think I finally got this to work! (I'm using a WP audio plugin and added some HTML elements for styling - in case anyone is wondering)

$AudioClip = get_group("Audio Clip");
if($AudioClip){
   foreach($AudioClip as $Audio){
   echo '<div class="audio_clip">';
        echo '<h3>' . $Audio['audio_clip_title'][1] . '</h3>';
        echo '<p>' . $Audio['audio_clip_description'][1] . '</p>';
                
        $mp3 = $Audio['audio_clip_file'][1];
        
        
         if (function_exists('insert_audio_player')) {  
  			  insert_audio_player('[audio:' . $mp3 . ']' );  		
		} else {
			echo '<p><a href="' . $mp3 . '">Download</a></p>';
		}
		echo '</div>';   
	}
} 

Open in new window

0
 
LVL 1

Author Closing Comment

by:Adam
ID: 35196698
I played around with it a bit more and finally got the solution I was looking for.
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

FAQ pages provide a simple way for you to supply and for customers to find answers to the most common questions about your company. Here are six reasons why your company website should have a FAQ page
When the s#!t hits the fan, you don’t have time to look up who’s on call, draft emails, call collaborators, or send text messages. An instant chat window is definitely the way to go, especially one like HipChat. HipChat is a true business app. An…
The purpose of this video is to demonstrate how to reset a WordPress password if you are locked out and cannot reset the password. A typical use would be if you cannot access the email to which WordPress would send the password recovery email to…
The is a quite short video tutorial. In this video, I'm going to show you how to create self-host WordPress blog with free hosting service.

634 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question