how to call jQuery in admin as well as in homepage
function test(){ wp_enqueue_script(‘myscript’, plugin_dir_url(__FILE__). ‘js/test.js’,array(‘jquery’)); } add_action(‘admin_print_scripts’,’test’); add_action(‘wp_head’,’test’);
function test(){ wp_enqueue_script(‘myscript’, plugin_dir_url(__FILE__). ‘js/test.js’,array(‘jquery’)); } add_action(‘admin_print_scripts’,’test’); add_action(‘wp_head’,’test’);
You need to wrap your code in either code or pre tags. code is for when inline code in a sentence e.g. include(“hello.php”) whereas pre is for preformatted blocks of text e.g.: function hello_world(){ echo ‘hello world’; } For code highlighting etc, you’ll need to look for plugins. The easiest way of using these tags … Read more
On the edit posts page, click on ‘Screen Options’ on the top right, and you can enter a value for the amount of posts per page.
This is more a basic PHP question than a WordPress one! $settings = get_option( “freshThemeSettings” ); $random = rand( 1, 11 ); if ( isset( $settings[ “fresh_banner$random” ] ) ) echo $settings[ “fresh_banner$random” ];
Yep! Check out wp_editor(). It was a one of the big new features in WP 3.3.
What your seeing is probably a PHP fatal error, however your server will be configured to log them to the error log rather than present it on the frontend. To find out what the error is, check your error log, or alternatively, if you don’t have access to the error log or enabling the error … Read more
WordPress only uses the tables it creates upon installation. Technically WP wouldn’t have a problem with removing tables that are not in the created tables. However, messing with the tables in the mysql database is not necessarily the best for MySQL itself. Also, if you are trying to optimize MySQL by removing tables and databases, … Read more
The content box is in a <div> with an ID of #postdivrich so you can hide it using CSS. Probably the easiest thing to do is to add a settings option to an existing page so you can turn it off or on. The post below covers that in detail: http://wpengineer.com/2139/adding-settings-to-an-existing-page-using-the-settings-api/ After you have the … Read more
This is how I did it : function if_restrict_categories($categories) { global $current_user; $a = get_cat_if_user($current_user->ID); $onPostPage = (strpos($_SERVER[‘PHP_SELF’], ‘edit-tags.php’)); if (is_admin() && $onPostPage && !current_user_can(‘level_10’)) { $size = count($categories); for ($i = 0; $i < $size; $i++) { if($categories[$i]->parent != $a && $categories[$i]->term_id != $a){ unset($categories[$i]); } } } return $categories; } add_filter(‘get_terms’, ‘if_restrict_categories’); And … Read more
I think this Custom Field Template plugin will help you. Plugin site. Don’t worry about Chinese screenshots. If you set at least one Custom Field Template for one category, when creating post and check that category additional options will appear.