Amegabosco’s Weblog

Believe it, it has already happened !!:

Convert form data to JS object with jQuery



serializeArray already does exactly that, you just need to massage the data into your required format:

$.fn.serializeObject = function()
    var o = {};
    var a = this.serializeArray();
    $.each(a, function() {
        if (o[] !== undefined) {
            if (!o[].push) {
                o[] = [o[]];
            o[].push(this.value || '');
        } else {
            o[] = this.value || '';
    return o;




down vote
I’m trying to use a Boostrap to layout a form with horizontal row inputs (a la « control-row ») but have labels positioned above the form input. See the layout below for an example.

Is this possible with Boostrap? I’m trying to avoid resorting to a million row/span# divs, but can’t find another way of implementing this without a lot of custom CSS. My current plan is to test out using tables :/ Please save me from that fate!

| Input | | Input |

| Long input |

| Input | | Input |
css twitter-bootstrap
share|improve this question
edited Jan 28 at 12:19

asked Sep 3 ’12 at 18:55

1613 – too many divs/spans? – David Spence Oct 3 ’12 at 13:28

You might want to edit the title of your question, since it says, BOOstrap (a Halloween pun, perhaps?), @user1644447 – Jonathan M Oct 12 ’12 at 13:24
1 Answer
up vote
down vote
I was able to get this accomplished without the use of tables, using a combination of control-row and control-group classes.

First Name:


Last Name:

Social Security Number:

Date of Birth:


In order to get it to work correctly though (since control-group divs are display: block;, I had to override that class and add a vertical-align: top; with the following):

.control-group {
display: inline-block;
vertical-align: top;
Here’s how it turned out:

How to remove/change JQuery UI Autocomplete Helper text?


    source: availableTags,
    messages: {
        noResults: '',
        results: function() {}

empecher les colonnes d’un tableau de déborder

I have a jQuery datatable(outlined in red), but what happens is that the table jumps out of the width I have set for the div(which is 650 px).

Here is the screen shot: enter image description here

Here is my code:

<script type="text/javascript">

    var ratesandcharges1;

    $(document).ready(function() {

        /* Init the table*/
            "bRetrieve": false,
            "bFilter": false,
            "bSortClasses": false,
            "bLengthChange": false,
            "bPaginate": false,
            "bInfo": false,
            "bJQueryUI": true,
            "bAutoWidth": false,
            "aaSorting": [[2, "desc"]],
            "aoColumns": [
            { sWidth: '9%' },
            { sWidth: '9%' },
            { sWidth: '9%' },
            { sWidth: '9%' },
            { sWidth: '9%' },
            { sWidth: '9%' },
            { sWidth: '9%' },
            { sWidth: '9%' },
            { sWidth: '9%' },
            { sWidth: '9%' },
            { sWidth: '10%' } ]


<div id="ratesandcharges1Div" style="width: 650px;"> 

<table id="ratesandcharges1" class="grid" >
        <!--Header row-->
            <th>Charge Code</th>
            <th>Total Charge</th>
            <th>VAT %</th>
            <th>Calc. Type</th>
            <th>Paid By</th>
    <!--Data row-->
            <td>Rental Time</td>
            <td>Rental Time</td>
            <td>Rental Time</td>
            <td>Rental Time</td>

Any ideas ?


asked Apr 8 ’11 at 5:21
did u try with width="650px" instead of style="width: 650px;" – diEcho Apr 8 ’11 at 5:30

add comment (requires 50 reputation)

4 Answers

Try setting the width on the table itself:

<table id="ratesandcharges1" class="grid" style="width: 650px;">

You’ll have to adjust the 650 by a couple pixels to account for whatever padding, margins, and borders you have.

You’ll probably still have some issues though. I don’t see enough horizontal space for all those columns without mangling the headers, reducing the font sizes, or some other bit of ugliness.

answered Apr 8 ’11 at 5:33
mu is too short
yeah I tried that. Still the same result in the browser. Is it possible to set the width to 650px and make the datatable scrollable from left to right to see the content on the far right. Thks for the reply. – Haxed Apr 8 ’11 at 5:37
You could put overflow-x: auto on #ratesandcharges1Div, that would put a horizontal scrollbar on the surrounding <div>. – mu is too short Apr 8 ’11 at 5:46
Was helpful. Thanks. – Haxed Apr 8 ’11 at 6:58
This fixed my problem. – Kenny Meyer Jul 17 ’11 at 22:42
this was long time ago, but it worked for me 😀 – Misters Jul 1 at 12:44

add comment (requires 50 reputation)

I found this on 456 Bera St. Man is it a lifesaver!!!

But – you don’t have a lot of room to spare with your data.


table {
    text-overflow: elipsis;
answered Jun 28 ’12 at 12:51
John K
thanks man, this was exactly what I needed. MUCH appreciated. – Code Sherpa Dec 27 ’12 at 22:31
ellipsis with two L-s. Minor point. – cartbeforehorse May 2 at 12:08

add comment (requires 50 reputation)

$(document).ready(function () {
              "sPaginationType": "full_numbers",
              "bJQueryUI": true,
              "bAutoWidth": false, // Disable the auto width calculation 
              "aoColumns": [
                               { "sWidth": "30%" }, // 1st column width 
                               { "sWidth": "30%" }, // 2nd column width 
                               { "sWidth": "40%" } // 3rd column width and so on 

specify the css for table 

table.display {
      margin: 0 auto;
      width: 100%;
      clear: both;
      border-collapse: collapse;
      table-layout: fixed; // ***********add this 
      word-wrap:break-word; // ***********and this 

<table id="companiesTable" class="display"> 
   <th>Company name</th>
   <% for(Company c: DataRepository.GetCompanies()){ %>
   <% } %>

It works for me.......
answered Dec 15 ’12 at 15:42
Exactly what I needed: the config options. – ChrisCantrell May 28 at 18:26

add comment (requires 50 reputation)

In java script calculate width using following code

var scrollX = $(window).width()*58/100; var oTable = $('#reqAllRequestsTable').dataTable({ "sScrollX": scrollX } );

answered Oct 3 ’11 at 10:15
add comment (requires 50 reputation)

Your Answer

Not the answer you’re looking for? Browse other questions tagged   or ask your own question.

input number formatter

generateur de guuid (globally unique identifier) en javascript

How to remove a wordpress theme action

First, create a child theme:


Child Themes

LanguagesEnglish • 日本語 • 한국어 • Français • Português do Brasil • Русский • Slovenčina • ไทย • 中文(简体) • 中文(繁體) • (Add your language)

A WordPress child theme is a theme that inherits the functionality of another theme, called the parent theme, and allows you to modify, or add to, the functionality of that parent theme. A child theme is the safest and easiest way to modify an existing theme, whether you want to make a few tiny changes or extensive changes. Instead of modifying the theme files directly, you can create a child theme. A child theme inherits all of the templates and functionality from its parent theme, but allows you to make changes to the parent theme because code in the child theme overwrites code in the parent theme.



Why use a Child Theme?

If you want to modify an existing theme, it is better to do it by creating a child theme than by modifying the parent theme directly. There are several reasons to use child themes:

  • If you modify an existing theme and it is updated, your changes will be lost. With a child theme, you can update the parent theme (which might be important for security or functionality) and still keep your changes.
  • It can speed up development time.
  • It’s a great way to get started if you are just learning WordPress theme development.

How to Create a Child Theme

  • Child Theme directory structure

    Create a directory in your themes directory to hold the child theme. The themes directory is wp-content/themes. You can name the directory whatever you want, but it is common practice to use the name of the parent theme folder with “-child” appended to it. So, for instance, if you are making a child of the twentytwelve theme, your folder name would be twentytwelve-child.

  • In the child theme directory, create a file called style.css. This is the only file required to make a child theme. The style sheet must start with the following lines:
Theme Name:     Twenty Twelve Child
Theme URI:
Description:    Child theme for the Twenty Twelve theme
Author:         Your name here
Author URI:
Template:       twentytwelve                             
Version:        0.1.0

You can change each of these lines to suit your theme. The only required lines are the Theme Name, and the Template. The Template is the directory name of the parent theme. In this case, the parent theme is the TwentyTwelve theme, so the Template is twentytwelve, which is the name of the directory where the TwentyTwelve theme resides. If you want to make a child of a theme with the directory name some-crazy-directory-name, then you would use Template: some-crazy-directory-name.

  • The child theme’s stylesheet will overwrite the parent theme’s stylesheet, but chances are you want to include the parent theme’s stylesheet. To do this, you need to start the stylesheet with the following line:
@import url("../twentytwelve/style.css");

Replace twentytwelve with the directory name of your parent theme. This line must go after the header code and before any other CSS rules. If you put other CSS rules before the @import, it will not work.

Template Files

If you want to change more than just the stylesheet, your child theme can overwrite any file in the parent theme: simply include a file of the same name in the child theme directory, and it will overwrite the equivalent file in the parent theme directory. For instance, if you want to change the PHP code for the site header, you can include a header.php in your child theme’s directory, and that file will be used instead of the parent theme’s header.php.

You can also include files in the child theme that are not included in the parent theme. For instance, you might want to create a more specific template than is found in your parent theme, such as a template for a specific page or category archive. See the Template Hierarchy for more information about how WordPress decides what template to use.

Using functions.php

Unlike style.css, the functions.php of a child theme does not override its counterpart from the parent. Instead, it is loaded in addition to the parent’s functions.php. (Specifically, it is loaded right before the parent’s file.)

In that way, the functions.php of a child theme provides a smart, trouble-free method of modifying the functionality of a parent theme. Say that you want to add a PHP function to your theme. The fastest way would be to open its functions.php file and put the function there. But that’s not smart: The next time your theme is updated, your function will disappear. But there is an alternative way which is the smart way: you can create a child theme, add a functions.php file in it, and add your function to that file. The function will do the exact same job from there too, with the advantage that it will not be affected by future updates of the parent theme. Do not copy the full content of functions.php of the parent theme into functions.php in the child theme.

The structure of functions.php is simple: An opening PHP tag at the top, a closing PHP tag at the bottom, and, between them, your bits of PHP. In it you can put as many or as few functions as you wish. The example below shows an elementary functions.php file that does one simple thing: Adds a favicon link to the head element of HTML pages.

function favicon_link() {
    echo '<link rel="shortcut icon" type="image/x-icon" href="/favicon.ico" />' . "\n";
add_action( 'wp_head', 'favicon_link' );

TIP FOR THEME DEVELOPERS. The fact that a child theme’s functions.php is loaded first means that you can make the user functions of your theme pluggable —that is, replaceable by a child theme— by declaring them conditionally. E.g.:

if ( ! function_exists( 'theme_special_nav' ) ) {
    function theme_special_nav() {
        //  Do something.

In that way, a child theme can replace a PHP function of the parent by simply declaring it beforehand.

Referencing / Including Files in Your Child Theme

When you need to include files that reside within your child theme’s directory structure, you will use get_stylesheet_directory(). Because the parent template’s style.css is replaced by your child theme’s style.css, and your style.css resides in the root of your child theme’s subdirectory, get_stylesheet_directory() points to your child theme’s directory (not the parent theme’s directory).

Here’s an example, using require_once, that shows how you can use get_stylesheet_directory when referencing a file stored within your child theme’s directory structure.

require_once( get_stylesheet_directory(). '/my_included_file.php' );

Other Useful Information

Using Post Formats

A child theme inherits post formats as defined by the parent theme. But, when creating child themes, be aware that usingadd_theme_support(‘post-formats’) will override the formats as defined by the parent theme, not add to it.

RTL support

To support RTL languages, add rtl.css file to your child theme, containing:

Theme Name: Twenty Twelve Child
Template: twentytwelve

@import url("../twentytwelve/rtl.css");

WordPress auto-loading rtl.css file only if is_rtl(). Even if the parent theme has no rtl.css file, it’s recommended to add the rtl.css file to your child theme.


Child themes, much like other extensions, may be prepared to be translated into other languages by using gettext functions. For an overview, please see I18n for WordPress Developers. This section will address special considerations regarding internationalization of child themes.

  • Start by adding a languages directory. Something like my-theme/languages/ works rather well.
  • Next, a textdomain needs to be loaded. load_child_theme_textdomain() can be used in functions.php during the after_setup_theme action. The following should illustrate:
 * Setup My Child Theme's textdomain.
 * Declare textdomain for this child theme.
 * Translations can be filed in the /languages/ directory.
function my_child_theme_setup() {
	load_child_theme_textdomain( 'my-child-theme', get_stylesheet_directory() . '/languages' );
add_action( 'after_setup_theme', 'my_child_theme_setup' );

At this point, hardcoded strings in the child theme are ready to be prepared to be translated. Here is a simple example of echoing the phrase « Code is Poetry »:

_e( 'Code is Poetry', 'my-child-theme' );

The text domain defined in load_child_theme_textdomain() should be used to translate all strings in the child theme. In the event that a template file from the parent has been included, the textdomain should be changed from the one defined in the parent to the one defined by the child.


removing an action:


Codex tools: Log in

Function Reference/remove action




This function is an alias to remove_filter().

This function removes a function attached to a specified action hook. This method can be used to remove default functions attached to a specific action hook and possibly replace them with a substitute. See alsoremove_filter()add_action() and add_filter().

Important: To remove a hook, the $function_to_remove and $priority arguments must match when the hook was added. This goes for both filters and actions. No warning will be given on removal failure.


<?php remove_action( $tag, $function_to_remove, $priority, $accepted_args ); ?>


(string) (required) The action hook to which the function to be removed is hooked.

Default: None
(string) (required) The name of the function which should be removed.

Default: None
(int) (optional) The priority of the function (as defined when the function was originally hooked).

Default: 10
(int) (optional) The number of arguments the function accepts.

Default: 1


Whether the function is removed.

  • True – The function was successfully removed.
  • False – The function could not be removed.


This function is identical to the remove_filter() function.   <?php remove_action($tag, $function_to_remove, $priority, $accepted_args); ?> 

If an action has been added from within a class, for example by a plugin, removing it will require accessing the class variable.

global $my_class;
remove_action( 'the_content', array( $my_class, 'class_filter_function' ) );

It is also worth noting that you may need to prioritise the removal of the action to a hook that occurs after the action is added. You cannot successfully remove the action before it has been added.


Change Log

Since: 1.2.0

Source File

remove_action() is located in wp-includes/plugin.php.



See also index of Function Reference and index of Template Tags.