For example when trying to set the url of an Ajax request in jQuery, or setting the path to an icon image file on a Google Map.
So I was trying to count the number of repeater rows for a ACF repeater field in my WordPress theme, something which I figured would be a simple use of the count() function on the returned field.
In turns out though, that the following code doesn’t work with a repeater field if it is part of a flexible content block. Continue reading “Developer // ACF: Counting Repeater Rows Inside Flexible Content”
Working on a new project and the client wanted to show a different number of posts displayed on the first page of posts, than on the rest. In order to enable promoted cards to be given more prominence on the first page. Continue reading “Developer // WordPress Query For Showing Different Number of Posts on Different Pages”
Had a request from a client to add categories and tags to their resources custom post type in WordPress.
Obviously I assumed there were predefined WP functions to implement this, but I found it hard to pin down a complete solution, so thought I would share mine here. Continue reading “Developer // Adding Categories and Tags Functionality To WordPress Custom Post Types”
First bit of new functionality work i’ve done in ModX for a longtime and I came unstuck by not being able to create any new template variables, due the the fact that ModX thought I had invalid characters in the variable title. Continue reading “ModX: Invalid Characters in a TV Name”
Quick post, more as a reference for myself, of how to get the extension of a file using PHP.
Discovered a great post on Cowburn.info outlining the various ways to do this and the time implications, ending up with:
$filename = 'mypic.gif';
$ext = pathinfo($filename, PATHINFO_EXTENSION);
being the best option. Continue reading “Getting File Extension Using PHP”
Working on a site which asks users to enter a “place name, area or postcode” to search by, niggly problem where searching for postcode “OX2” for example, not only returned properties in OX2, but also in OX29. Continue reading “Using RegEx To Determine If Search Query Is A Postcode/Partial Postcode”
In the middle of a Drupal install on my localhost I received the following error
No such file or directory (trying to connect via unix:///var/mysql/mysql.sock) i…
2AM and in need of a quick fix I just created an alias in the location PHP was looking for mysql.
ln -s /tmp/mysql.sock /var/mysql/mysql.sock
When writing a function to save audio files with a user friendly filename , as well as a regex to remove any unwanted spaces and punctuation, I needed to replace any accented characters with their standard format.
e.g If I was saving a Beyoncé album I needed the ‘é’ in her name to be replaced with an ‘e’.
The following works perfectly:
Trying to incorporate a Zend session on a page being viewed as part of a frameset caused me a headache yesterday.
I couldn’t understand how everytime I refreshed the page to try and test the session it seemed to be reset. Var_dumping the session before and after the data was getting assigned showed that everything was getting stored as expected, but each time the page loaded, the session returned NULL again. Continue reading “Using Zend session with an HTML framset”