Get file headers in custom file

Use get_file_data( $file, $headers ): $file_data = get_file_data( __FILE__, array ( ‘Plugin Name’ ) ); echo “the name is ” . $file_data[0]; Make sure the first parameter points to an existing file. It will find all lines that are formatted like regular plugins headers or the headers of a style.css. In my plugin T5 Opera … Read more

Is it save to require plugin.php early to be able to use get_plugin_data() earlier?

At first glance it works and I cannot see any implications but maybe you are aware of some? You say that you are not getting errors, which I would have expected but it looks as though WordPress uses require_once() so you are probably safe: 39 /** WordPress Plugin Administration API */ 40 require_once(ABSPATH . ‘wp-admin/includes/plugin.php’); … Read more

Plugins or Tutorials for displaying data from SQL-db on WP-page? [closed]

This is a pretty vague and broad question, but I’ll give it a shot. You can add the following code into a functionality plugin or if you’re running a theme, you could place it in your theme’s functions.php file. (Obviously you’ll have to change the SQL, attributes, etc – just a proof of concept) add_shortcode( … Read more