Posted on Leave a comment


As a programmer, I often feel like an artist reusing the same canvas over and over and no one ever looks at the painting. As I make modifications and improvements to a program, my previous creation vanishes often without having been appreciated by another programmer. I write tomes of code and a vast percentage of that writing ends up in the fire.

Posted on 11 Comments

WordPress 3.4 limited to 90 menu items

I’m working on a WordPress site. The site is to have roughly 106 pages all accessible via the WordPress menu system so that the enduser can add and remove pages from the menu as they like. Unfortunately, WordPress currently only allows 90 nodes (ie. 90 menu items) per menu. I have not figured out if this is a memory limitation, a hard coded limitation, or a setting yet. This must be overcome!


Possible solutions:

  • Use add descendants as submenu items plugin
  • Check error logs and make sure max post vars was not exceeded. If so, increase in either .htaccess or php.ini
  • See if and suhosin.request.max_vars are used with Dreamhost
Posted on Leave a comment

Changing the behavior of WordPress’ Publish button

A long unrealized goal of mine has been to change the behavior of WordPress’ publish button when adding a new post. Today, I’ll spend a little time examining the underlying code.

obert- and pixolin in Freenode’s #wordpress gave me good pointers to the WordPress forum and the WordPress hook directory.

I narrowed it down to two functions: wp_insert_post() and wp_publish_post(). Turns out that the correct function is wp_insert_post(). The only thing that wp_publish_post() does is to transition the status. Looks like I should be able to alter wp_insert_post() in my functions.php file and achieve my goal.

Got it!

Relevant references:

Posted on Leave a comment

Cross-domain communication

If I have an aspx site on one server, let’s call it and I have a php site on another server, let’s call it, and I want to use an iframe to include data from within the site, security for iframes prevents this correct?

So, if I instead create a subdomain of, let’s call it and use for the aspx site, does that overcome the cross-domain security issue since both sites are now part of the domain or does the nature of being a tertiary domain still create the security issue since is technically different than

Posted on Leave a comment

WordPress Hooks, Actions and Filters – Modifying the Publish function

I’m writing a child theme to twentyeleven and want to modify the administrative post "Publish" function to do some additional processing during the saving of a new post. Does anyone know if there is a hook, action or filter that will allow me to extend the Publish function?

Posted on Leave a comment

Subversion Error Message On Branch/Tag

Today’s tech problem:

I am trying to create a new baseline for my code. I have checked my code out of my repository, updated individual files to the proper version for the baseline, and then when I try to tag or branch the working copy, I get an error.

Error Commit Failed (details follow):
Error File
Error ‘/svn/foo/bar/branches/blah/snafu/path/to/file/file.cfm’
Error already exists

Because of the failure, the branch attempt, or tag attempt, fail leaving the branch/tag empty.

How can the file already exist if the branch/tag starts out completely empty?

Posted on Leave a comment

Call to action: WordPress Developers Please Comment

Hello WordPress developers! (me included). When you make a theme, I implore you, please use a simple html comment at the top of each page to identify the template. For example: <!- – TEMPLATE: single.php – -> would allow someone unfamiliar with your theme to look in the generated source and see which template(s) are influencing the output. Yes, experienced WordPress developers should already know which files are being used but we don’t write themes only for experienced developers. And even experienced developers get stuck, tired, or would like things to be sped along and a simple comment, <!- – TEMPLATE: page.php – ->, would help tremendously. Thank you!

Posted on Leave a comment

Don’t use underscores in css ids

Today’s reminder from your friendly neighborhood codeslinger is "don’t use underscores in css ids!" You know, those lines _ that programmers like to use instead of spaces in variable names (because you can’t really have spaces in a variable name in most languages). This was an illegal character in the original CSS1 and CSS2 specifications (updated in 2001 to be valid) so setting an id to foo_bar (e.g. <div id="foo_bar">) would be translated by the browser as foo\_bar (e.g. <div id="foo\_bar">), well, some browsers, not all browsers because you know browsers are so consistent in their interpretation and implementation of these so called web standards.

The solution? Instead of underscores, opt for dashes (e.g. <div id="foo-bar">) or camel case (e.g. <div id="FooBar">) but remember that id’s and class names are case-sensitive.

See also.

Posted on 10 Comments

jquery challenge of the day

And now for something completely different…

Let’s say you have a table that could have infinite rows. The table has an id but none of the other elements (ie. we won’t be traversing by id). The column to the furthest right of the row has an anchor tag in the for of an <a href> There are no other anchors on that row. What I want to do is when the anchor tag is clicked, have the <a href> text in the row above the clicked on turn bold and only that <a href>. Sample table:

<table id="tbl">
         <th>col 1 label</th>
         <th>col 2 label</th>
         <td>sometext <a class="tt" href="#">link</a></td>
         <td>moretext <a class="tt" href="#">link</a></td>
         <td>differenttext <a class="tt" href="#">link</a></td>
         <td>othertext <a class="tt" href="#">link</a></td>

So, if I click the link in row three, I want the text "link" in row two to become bold. This is using jquery and traversing this is kicking me hard.

Posted on Leave a comment

jQuery roadblock

jQuery problem:

<tr><td>one</td><td>two</td><td>three</td><td><a class=”foo” href=””>click me first</a></td></tr>
<tr><td>one</td><td>two</td><td>three</td><td><a class=”bar” href=””>click me second</a></td></tr>

What jQuery would allow me to click on "click me second" and change the color of the text "click me first"?

It’s a little more complicated than that. The real source has a plus image on the first row. Once you click that I use .hide() to make the plus go away. I create the 2nd row which has a minus image and a plus image. If you click the plus image, it disappears and creates a third row. The minus image, should 1st) cause the immediate plus image above it to appear 2) then disappear its own row. All plus images have a class of "addrow" and minus images have a class of "deleterow" I thought prev() would be doing it but I get nothing. Specifically .prev(‘.addrow’).show();

Posted on Leave a comment

Magento – Not currently favorite color

Why is debugging and troubleshooting in Magento so difficult? Because of error messages like this:

Notice: Undefined variable: rootNode in C:\Domains\\wwwroot\magento\app\code\core\Mage\Eav\Model\Entity\Attribute\Source\Config.php on line 53
#0 C:\Domains\\wwwroot\magento\app\code\core\Mage\Eav\Model\Entity\Attribute\Source\Config.php(53): mageCoreErrorHandler(8, ‘Undefined varia…’, ‘C:\Domains\exam…’, 53, Array)
#1 C:\Domains\\wwwroot\magento\app\code\core\Mage\Adminhtml\Block\Widget\Form.php(196): Mage_Eav_Model_Entity_Attribute_Source_Config->getAllOptions(true, true)
#2 C:\Domains\\wwwroot\magento\app\code\core\Mage\Adminhtml\Block\Customer\Edit\Tab\Account.php(54): Mage_Adminhtml_Block_Widget_Form->_setFieldset(Array, Object(Varien_Data_Form_Element_Fieldset))
#3 C:\Domains\\wwwroot\magento\app\code\core\Mage\Adminhtml\Block\Customer\Edit\Tabs.php(58): Mage_Adminhtml_Block_Customer_Edit_Tab_Account->initForm()
#4 C:\Domains\\wwwroot\magento\app\code\core\Mage\Core\Block\Abstract.php(642): Mage_Adminhtml_Block_Customer_Edit_Tabs->_beforeToHtml()
#5 C:\Domains\\wwwroot\magento\app\code\core\Mage\Core\Block\Text\List.php(43): Mage_Core_Block_Abstract->toHtml()
#6 C:\Domains\\wwwroot\magento\app\code\core\Mage\Core\Block\Abstract.php(643): Mage_Core_Block_Text_List->_toHtml()
#7 C:\Domains\\wwwroot\magento\app\code\core\Mage\Core\Block\Abstract.php(503): Mage_Core_Block_Abstract->toHtml()
#8 C:\Domains\\wwwroot\magento\app\code\core\Mage\Core\Block\Abstract.php(454): Mage_Core_Block_Abstract->_getChildHtml(‘left’, true)
#9 C:\Domains\\wwwroot\magento\app\design\adminhtml\default\default\template\page.phtml(58): Mage_Core_Block_Abstract->getChildHtml(‘left’)
#10 C:\Domains\\wwwroot\magento\app\code\core\Mage\Core\Block\Template.php(144): include(‘C:\Domains\leoa…’)
#11 C:\Domains\\wwwroot\magento\app\code\core\Mage\Core\Block\Template.php(176): Mage_Core_Block_Template->fetchView(‘adminhtml\defau…’)
#12 C:\Domains\\wwwroot\magento\app\code\core\Mage\Core\Block\Template.php(193): Mage_Core_Block_Template->renderView()
#13 C:\Domains\\wwwroot\magento\app\code\core\Mage\Adminhtml\Block\Template.php(81): Mage_Core_Block_Template->_toHtml()
#14 C:\Domains\\wwwroot\magento\app\code\core\Mage\Core\Block\Abstract.php(643): Mage_Adminhtml_Block_Template->_toHtml()
#15 C:\Domains\\wwwroot\magento\app\code\core\Mage\Core\Model\Layout.php(526): Mage_Core_Block_Abstract->toHtml()
#16 C:\Domains\\wwwroot\magento\app\code\core\Mage\Core\Controller\Varien\Action.php(347): Mage_Core_Model_Layout->getOutput()
#17 C:\Domains\\wwwroot\magento\app\code\core\Mage\Adminhtml\controllers\CustomerController.php(117): Mage_Core_Controller_Varien_Action->renderLayout()
#18 C:\Domains\\wwwroot\magento\app\code\core\Mage\Core\Controller\Varien\Action.php(376): Mage_Adminhtml_CustomerController->editAction()
#19 C:\Domains\\wwwroot\magento\app\code\core\Mage\Core\Controller\Varien\Router\Standard.php(248): Mage_Core_Controller_Varien_Action->dispatch(‘edit’)
#20 C:\Domains\\wwwroot\magento\app\code\core\Mage\Core\Controller\Varien\Front.php(158): Mage_Core_Controller_Varien_Router_Standard->match(Object(Mage_Core_Controller_Request_Http))
#21 C:\Domains\\wwwroot\magento\app\Mage.php(459): Mage_Core_Controller_Varien_Front->dispatch()
#22 C:\Domains\\wwwroot\magento\index.php(65): Mage::run()
#23 {main}

Yes, it screams "undefined variable" which is rootNode but through Magento’s excellent use of object oriented spaghetti, the error does not in anyway reveal what is truly causing rootNode to be undefined nor where to even begin looking.