Add script into front from my plugin

Use wp_enqueue_scripts and admin_enqueue_scripts actions to enqueue your scripts: // for front end add_action(‘wp_enqueue_scripts’, array(&$this, ‘load_my_scripts’)); // for back end add_action(‘admin_enqueue_scripts’, array(&$this, ‘load_my_scripts’)); Also pay attention that it is bad practice to load your scripts on all pages of the site. Load your script only if need be: // … function load_my_scripts() { if ( … Read more

Redirect after delete post in Frontend

I got a little bit more into this topic and found this solution which works perfect for me. 1 Add this code to functions.php: // Delete post function delete_post(){ global $post; $deletepostlink= add_query_arg( ‘frontend’, ‘true’, get_delete_post_link( get_the_ID() ) ); if (current_user_can(‘edit_post’, $post->ID)) { echo ‘<span><a class=”post-delete-link” onclick=”return confirm(\’¿Are you sure to delete?\’)” href=”‘.$deletepostlink.'”>Borrar</a></span>’; } } … Read more

How to call plugin functions in a custom template

There can be various reason for the undefined function error: The plugin might load its function definitions later than template_include or in the admin backend only. You might have made a syntax error, for example if the plugin is using a namespace, but you are calling the function without that namespace. Or the function is … Read more

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