Variable not staying set
Well, this is PHP… if ($job_file == NULL) { … You might want to compare, and not set, right?
Well, this is PHP… if ($job_file == NULL) { … You might want to compare, and not set, right?
The function bbp_forum_id() will directly echo its value, you want to use bbp_get_forum_id() which will return the value for use in the context of an API call.
Check out this Alternative <?php // in the loop: $template = get_page_template_slug( get_the_ID() ); if (in_array($template,array(‘home1′,’home2’)) ) ){ // Yep, Do your stuff } // anywhere: $template = get_page_template_slug( $some_post_ID ); if (in_array($template,array(‘home1′,’home2’)) ) ){ // Yep, Do your stuff } ?>
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
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
$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
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
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
If I were you, I’d store the GPS coordinates in the post meta. Maybe display a meta box on the edit pages, if you want to change it. Otherwise, add the post meta once and forget about it. Then you can use the wp_footer hook to print the javascript with the post meta value as … Read more
Track usernames with piwik [closed]