How to call images from your plugins image folder?

Use plugin_dir_url() to get the public URI for the directory where the calling PHP file is. <img src=”https://wordpress.stackexchange.com/questions/60230/<?php echo plugin_dir_url( __FILE__ ) .”images/facebook.png’; ?>”> If the PHP file is in a sub directory of your plugin you have to go up: <img src=”https://wordpress.stackexchange.com/questions/60230/<?php echo plugin_dir_url( dirname( __FILE__ ) ) .”images/facebook.png’; ?>”>

How can I add an option to the Page Template list from a Plugin?

Filters? Anyone? There’s no filter there to help: page_template_dropdown($template); is used to build the drop down and it’s not filterable. Sneaking into the Templates Array? To build the drop downs contents, the core meta box uses get_page_templates(). From inside, the function looks like the following: $themes = get_themes(); $theme = get_current_theme(); $templates = $themes[$theme][‘Template Files’]; … Read more

Change the_title() of a page dynamically

I would use the is_page_template() conditional: if ( is_page_template( ‘page-courses.php’ ) ) { // The current page uses your // custom page template; // do something } Edit You would use this conditional inside your filter callback: function wpse83525_filter_the_title( $title ) { if ( is_page_template( ‘page-courses.php’ ) ) { return ‘Custom Title’; } return $title; … Read more

How to output message during plugin activation

For testing purposes you can use the log system (php_error.log): error_log(‘Plugin activated’, 0); // Check for DB table existance if(!$this->hasDBTable()){ error_log(‘Database not present’, 0); if($this->createCELabelsDBTables()){ error_log(‘Database was created.’, 0); } else { error_log(‘Error creating the CE Labels Plugin db tables!’, 0); } } else { error_log(‘Database OK’, 0); } To output error to the user … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)