Articles of functions

Problem in using Customizer

Looking for some help with a customizer problem. I am using following codes to create a customizer which will allow me to upload an image for topic of the week section. owever, the following codes doesn’t seem to work properly and was not displaying image. Plzz help guys.. This is the function i am using […]

shorthand syntax for custom fields

I’m trying to write a shortcode and am sorely out of practice with this stuff. It’s for a plugin Full Width Audio Player and I’m trying to query all tracks within a certain playlist so it will output the track names to add to the player queue. function kc_tracks ($atts, $content = null) { extract(shortcode_atts(array( […]

Show different website layout if no sidebar added

I have a question about website layout with and without wp widges in sidebar. Here is the code i have for my registered sidebar. <?php if ( !function_exists(‘dynamic_sidebar’) || !dynamic_sidebar(products) ) : endif; ?> And this is the code i have in functions.php if (function_exists(‘register_sidebar’)) { $opts = array( ‘name’ => ‘Products’, ‘before_widget’ => ‘<div […]

How to display 2 function calls in same line?

<?php the_author_posts_link(); ?> <?php the_time(‘g:i a’); ?> When I call above 2 functions you will see the output in two lines. But what Need is “Andrew 2.10” I need both output in same line. How to do it.

WordPress performance – send all metaboxes to function or to call it again

I need to send my metabox information to a function – the meta is already called on page template $meta = get_post_meta(get_the_ID()) but I need to use this data in function the metaboxes are around 20 and containing different information (strings, arrays, multidimensional arrays, etc) For best WordPress performance which is better option – to […]

How do I pull avatar from post using BuddyPress?

I’d like to pull the avatar of a blog post’s author and display it on the page using BuddyPress but I cannot seem to pull it off. How would I go about this?

How do I place a function in a standalone page?

Im trying to a a function to create an rss feed from a gmail dress. This works if i place it in functions.php, but overtakes my site as an rssfeed, as expected. How do I place it in a standalone page, something like /gmailrss? The snippet if needed: function checkGmail($username, $password) { $url = “https://mail.google.com/mail/feed/atom”; […]

Ajax resetting my global variable

I am wondering why I can’t read the updated value of $_TEST. It seems that $_TEST is being reset with each Ajax call. // functions.php $_TEST = 0; // the variable I want to update with each Ajax call if ( is_admin() ) { add_action( ‘wp_ajax_get_global_val’, ‘get_global_val’); add_action( ‘wp_ajax_nopriv_get_global_val’, ‘get_global_val’); } function get_global_val() // my […]

Function that prevents users from uploading photos more photos

Mjello, I’m struggling with this function that prevents users from uploading more photos than what their membership are entitled to. So they have 10 photos to upload. When they’ve reached 0 they should no longer be able to upload a photo. As it is now, the image that they’re uploading when they’ve have reached 0 […]

Is it legal to redefine wp_password_change_notification in a mu plugin?

I am trying to add some logic to this function of when to alert the admin to a password change but no email is being sent at all. The codex says it needs to be declared in a plugin, so is this legal from a mu plugin or is there only specific locations this can […]