• Resolved RockoRobotics

    (@rockorobotics)


    I have an Ajax function defined and it is being called with the usual add_action wordpress functions:

    function ajax_glossary()
    {
        //Lots of Lines of code
    }
    
    add_action( 'wp_ajax_ajax_glossary', 'ajax_glossary' );
    add_action( 'wp_ajax_nopriv_ajax_glossary', 'ajax_glossary' );

    In this function, I am pulling back a custom post type that was created by Magic Fields 2 and it has several custom fields associated with it. Here is one of the lines of code:

    $strApplicationName = get('applications_application_name',$iGroup,1,$post->ID);

    The problem is that my ajax call is returning the typical php function not found message:

    Fatal error: Call to undefined function get()

    This is the first time I have used admin-ajax.php with a WordPress theme, but I went through the code and it looks like WordPress is including the necessary plugin files. If I remove the Magic Fields specific functions, the Ajax call will return the expected post data without error. As a note, Magic Fields 2 is working great in other non-ajax portions of the theme.

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

Viewing 2 replies - 1 through 2 (of 2 total)
Viewing 2 replies - 1 through 2 (of 2 total)

The topic ‘Using Magic Fields 2 Template Functions with Ajax Calls’ is closed to new replies.