How to pass variables from a function in functions.php to an other one

get_the_utm_vars doesn’t work like you think it does. A function cannot return more than one value. Right now, when the first return is reached, that value is returned and none of the following lines are ever reached. You could have get_the_utm_vars return an array of values instead: function get_the_utm_vars(){ $utm = array(); $utm[‘source’] = htmlspecialchars( … Read more

html element to separate php variable strings – ACF datepicker

thanks to @kero, i managed to do something like this : <?php $dayNumber = “l”; $weekDay = “j”; $month = “F”; $year = “Y”; $unixtimestamp = strtotime(get_field(‘date’)); ?> <?php echo ‘<span>’ . date_i18n($dayNumber, $unixtimestamp) . ‘</span>’; ?> <?php echo ‘<span>’ . date_i18n($weekDay, $unixtimestamp) . ‘</span>’; ?> <?php echo ‘<span>’ . date_i18n($month, $unixtimestamp) . ‘</span>’; ?> … Read more

What is the use of $content_width?

$content_width is used to set the default width of embeds, for situations when an element needed to specify a width. This is how WP knew the width of the main content area. However, this was back before the push for responsive design, and modern CSS with fluid embeds and responsive breakpoints. So it isn’t needed … Read more

How do I share variables between two functions?

Create a class to store the variables as private, internal members. Set up the variables when the post object is set up, that’s the action the_post. Then assign class methods as callbacks instead of separate functions. Here is your code slightly reformatted: The class class WPSE_WC_Badge { private $title=””; private $class=””; private $duration = ”; … Read more

Best way to pass variables around a WordPress site?

It is possible to do this using the function wp_get_current_user(). This function will get the contents of the WP_User class. It can be stored in a global variable: global $current_user; $current_user = wp_get_current_user(); $current_user will then become an array matching the properties of WP_User for the currently logged in user. If no user is logged … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)