Wordpress

When you have a lot of settings fields with the same type, it is often annoying to write a display function for every field.
There is a simple and better way to do this.

Example:
You want to make a checkbox for every menu in from WordPress administration.
First you get the menus:

$menus = $GLOBALS[‘menu’];

Now we create a new settings section:

add_settings_section(“menu-test-section-“, “”, “”, “menu-test-options”);

Now traverse through every menu entry, create a settings field and register this field. (more…)

 

Menu poisitions in wordpress admin menu

  • 2 Dashboard
  • 4 Separator
  • 5 Posts
  • 10 Media
  • 15 Links
  • 20 Pages
  • 25 Comments
  • 59 Separator
  • 60 Appearance
  • 65 Plugins
  • 70 Users
  • 75 Tools
  • 80 Settings
  • 99 Separator

(more…)

1. Author pages

WordPress as a much used content management system always suffers from hacks. These hacks mostly try to login to the admin desktop and inject malware code into wordpress.

To login to WordPress the hackers use a known issue from WordPress, the author request.

Syntax is:

http://www.somedomain.com/?author=x

where x is a number, starting from 1. (more…)

WordPress offers a simple way to add javascript code to your site.

Example:

wp_deregister_script('scriptname'); // Optional

wp_register_script(‘scriptnamey’, get_bloginfo(‘template_directory’) . ‘/js/scriptname.js’);

wp_enqueue_script(‘scriptname’);

(more…)