Suffice
Suffice

Reputation: 39

A bit of help needed with PHP functions

Error:

Fatal error:Call to undefined function everything_loop()

Is there anyway around this? It gets an error before it even gets called for...

<?php
function EG204_2nd_Edition_to_Menu()
{
    add_menu_page( 'EG-204', 'EG-204 Ver. 2', '7', 'EG', 'EG204_ExoSkel' , '' , '4.2' );
}
function EG204_ExoSkel() { 

everything_loop();

function everything_loop() {

echo 'Everything!';

}

}

add_action('admin_menu', 'EG204_2nd_Edition_to_Menu');
?>

Upvotes: 0

Views: 48

Answers (2)

Shackrock
Shackrock

Reputation: 4701

Your brackets aren't right:

<?php

function EG204_2nd_Edition_to_Menu()
{
    add_menu_page( 'EG-204', 'EG-204 Ver. 2', '7', 'EG', 'EG204_ExoSkel' , '' , '4.2' );
}


function EG204_ExoSkel() { 

    everything_loop();
}


function everything_loop() {

echo 'Everything!';

}


add_action('admin_menu', 'EG204_2nd_Edition_to_Menu');

?>

Upvotes: 2

Mathematician
Mathematician

Reputation: 11

It is inside another function because you have bracket at the wrong place.

Upvotes: 0

Related Questions