Developer // Accessing WordPress URL Function Values Within Javascript

During my custom WordPress theme development I often find that it would be really useful if I could just use the WordPress get_template_directory_uri() or home_url() functions from within Javascript.

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.

Thankfully, if you’re using WordPress in the way it’s intended, there is a very simple way to make this possible. Continue reading “Developer // Accessing WordPress URL Function Values Within Javascript”

Developer // ACF: Counting Repeater Rows Inside Flexible Content

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”

Developer // Removing Sub Page Menu Item In WordPress Whilst Still Allowing Page Access

Had an error in from a website where the admin couldn’t gain access to edit registrations in WordPress backend. Receiving the following “you are not allowed access” error:

wordpress access error

On closer inspection to the code it appeared in trying to hide the ‘Add New’ option for the post type from the admin menu, the developer had inadvertently removed access to the registration form page. Continue reading “Developer // Removing Sub Page Menu Item In WordPress Whilst Still Allowing Page Access”