Display an image of selected template in admin to aid user when using complex templates

Preliminary Tasks Create a directory within your theme to contain your layout thumbs. Add layout thumbs to reflect the file names of your template. The following script uses the format tpl-homepage.php. The image would be named homepage.jpg. Please note, the following is a proof-of-concept. Approach 1: Only JavaScript Load the following only for post.php and … Read more

Add JavaScript in admin in custom plugin [duplicate]

Admin area has its own hooks in header and footer, respectively: do_action(‘admin_enqueue_scripts’, $hook_suffix); do_action(“admin_print_styles-$hook_suffix”); do_action(‘admin_print_styles’); do_action(“admin_print_scripts-$hook_suffix”); do_action(‘admin_print_scripts’); do_action(“admin_head-$hook_suffix”); do_action(‘admin_head’); and do_action(‘admin_footer’, ”); do_action(‘admin_print_footer_scripts’); do_action(“admin_footer-” . $GLOBALS[‘hook_suffix’]);

Get options from database using php class

If you have registered your option without setting the fourth parameter $autoload to no your calls to get_option will not trigger any extra database call because all aotoload options are stored in the cache when the site is loaded. To test it add … define( ‘WP_DEBUG’, TRUE ); define( ‘SAVEQUERIES’, TRUE ); … to your … Read more

Visual Editor only working for the admin user

http://wordpress.org/support/topic/upgraded-to-32-visual-editor-buttons-missing/page/2 this fixed it. The Tiny MCE is looking for a file: wp-includes/js/tinymce/langs/en.js I just checked the file and on my installation the file path is this: wp-includes/js/tinymce/langs/wp-langs-en.js I deleted the ‘wp-langs-‘ part of the file name ‘wp-langs-en.js’ and I seem to be working again.

Send email to admin with post author

Missing global ? global $post; No global variable available if you are using publish_post action hook! Ref : http://hungred.com/how-to/tutorial-post-id-publishpost-action-hook-wordpress/ Update 2 : or try this $author = get_userdata($post->post_author); So you can use $author where you will 😀

Posts in sidebar only by admin

You need to add an author parameter to the query that is creating $cust_loop. You didn’t post that part of your code but something like: $cust_loop = new WP_Query( ‘author=123’ ); Or: $cust_loop = new WP_Query( ‘author_name=rami’ ); Note: Both of those taken (almost) straight from the Codex paged for WP_Query.

Publish page by invoking submit via jQuery

Trigger the click event of the publish button instead, and let WP do the work. <script> jQuery(document).ready(function( $ ) { $( “#secondary-publish” ).click(function () { $( “#publish” ).click() }); }); </script> Don’t use language (it was deprecated in HTML 4.01!) – you can drop type too (WP now has an HTML5 doctype).

How to add an admin alert for missing plugins

To check if a plugin is installed and activated, use the is_plugin_active() function. Note that you need to include this function first on the front-end before you can use it: include_once ABSPATH.’wp-admin/includes/plugin.php’; Avoid function_exists() for doing the check. Plugins may refactor their code and a previously existing function might disappear. You never know.

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