I’m not fully familiar with OOP but this function has me stumped. I’d like to echo out the
$ct->title
I’ve tried putting this into an array which I can print_r and have it print like an array but I cant target the specific title attribute. Thanks in advance
add_menu_page( $ct->title . ' Options and Settings', $ct->description ;?>
has to be enclosed in a function due to WordPress and it’s add_action() methods. I think I have to approach this in another way, as in build my own function using the get_themes() and get_current_themes() functions used in the original function. They output arrays.
Thanks. I was needing a good laugh.
Here is what I’m trying to do. The function in my original post is a core function in WordPress.
I want to access the member variables as strings to place into the parameters of another wordpress function. Like this.
echo $ct->title;
function build_toplevel_menu() {
global $ct, $shortname;
add_menu_page( $ct->title . ' Options and Settings', $ct->description ;
}
Where there is a $ct is where I would like to access these member functions and can’t. Outside the function using echo as above the function, works fine. Thanks for all your help.
I’ll give you a hint. There’s something missing from the second box…coughfunctionwithnoparameterscough
If this function is actually a method of the class, it should be $ct->current_theme_info(); . If you’re trying to call a function passing the object to it, the function definition needs to have a parameter in it; function current_theme_info($ct) {
Okay that explains that we are dealing with an object. Thanks very clear.
Now how do I access this object
$ct->whatever
and have the contents display on the page.
Using the echo function works
echo $ct->whatever
but only if it is outside of a function. I would like to use these “member variables” as parameters that are to be strings. In an array I would use a foreach statement to return a variable, but that’s not an option here. Any suggestions?