Articles of functions

Why isn't is_page working when I put it in the functions.php file?

I have page called “Apple”, the page’s ID id 2533. In page.php file I have line: echo $bannerimg And this function in functions.php: if ( is_page( ‘2533’ ) ) { // also tested with ‘Apple’ $bannerimg = ‘apple.jpg’; } elseif ( is_page( ‘test’ ) ) { $bannerimg = ‘test.jpg’; } elseif ( is_page( ‘admissions’ ) […]

Display a query with multiple post types and same relationship on a single page

I am creating a client portal were my clients can maintain their projects and leave feedback in WordPress. I have two custom post types called “Clients” and “Projects” and they each pull information from one another in the backend. When I create a client it automatically generates its postID to a drop down menu on […]

Adding a second email address to a completed order in WooCommerce

Before I ask this question, I know there is a (legitimate) hesitation to answer questions here about Woo products since they have their own support and their users should be encouraged to use that. I am a paying Woo user but couldn’t solve this with their paid support, and my question is about overriding classes […]

How to add a data attribute to a WordPress menu item

I’m Twitter Bootstrap and need to add data-toggle=”modal” attribute to the a tag of menu link. Upon searching most all results reference doing a walking for Twitter Bootstrap dropdown menus however this menu has no dropdowns and I only need to add the particular attribute. Next I found this: Add custom attributes to menu items […]

Include files in child theme functions file

Typically in my theme function file I’ll require other files to keep things neat. require_once(“foo.php”); Now working in a child theme I’d like to do that same. I’m adding custom admin options and it seems impossible to include code. I’ve echoed out the path to make sure I’m calling the right file and it is […]

Import WordPress XML File from Within Functions.php

I am developing a theme which has a different method of adding in content and so, the default install of WordPress won’t show any content because of this. I was wondering if it is possible to automatically import an XML file via means of an internal function and or hooks after the theme has been […]

Is it ok to use a function to output the text domain name in a wordpress theme

I am working on a theme and I want to make it available for translating. I have not been including a text domain on translated text because I don’t know what the text domain is going to be yet. I figured, until I can come up with a name for my theme I should just […]

How to load parent_theme functions.php before child_theme?

I got the problem that i have to load my parent theme’s functions.php file before my child theme’s functions.php file loads. This is needed for the setup & init procedure. I looked at the hooks inside /wp_core_root/wp-settings.php (named: do_action(‘setup_theme’);). The problem is that i don’t know how to hook into there, because the first file […]

Displaying the number of updates available in the Admin area

I am having an issue finding out how to display the number of plugins/updates available to call somewhere else other than the admin header. I found the function wp_get_update_data should be what I need: How is the " wp_get_update_data " function used? However, I wasn’t sure how to get this to display as an actual […]

Ajax call always returns 0

I have a problem with AJAX returning 0 always! I have done everything by the book and can’t figure out what is wrong? Please help!! Here is my Ajax call: //Pass data through AJAX var amountToConvert = price; jQuery.ajax({ type:”POST”, url: “../../wp-admin/admin-ajax.php”, // our PHP handler file action: “ajaxConversion”, data: { amount: amountToConvert }, success:function(data){ […]