New walker for walker_nav_menu to change inside container data

Well, you wouldn’t need a walker for that, if it’s simply adding a data attribute or something like that you could just use the items_wrap parameter. View wp_nav_menu() in Resources: $items_wrap = ‘<div class=”top-nav” mine=”something”>’; $items_wrap .= ‘<ul id=”%1$s” mine=”something2″ class=”nav %2$s”>%3$s</ul>’; $items_wrap .= ‘</div>’; wp_nav_menu( array( ‘container’ => false, ‘echo’ => true, ‘before’ => … Read more

Displaying text if post was within 5 hours

human_time_difference() will not work here as it returns a string in a human readable form. However, we can use some of the logic used there to construct a workable function You can try the following: (Untested) function get_custom__time_diff() { global $post; // Get the current time $current_time = time(); // Get the post date $post_date … Read more

PHP: Showing currency sign if input is a number

Here you go: According to documentation of get_post_meta , It will return a single value if the third parameter is true. It should be false to return an array. <?php $price = get_post_meta(get_the_ID(),’si-price’); foreach ($price as $element) { if (is_numeric($element)) { echo ‘$’ . $element; } else { echo $element; } } ?>

Double jQuery loaded

You can enqueue all your scripts the same way as you enqueue jQuery. Register and enqueue all your Javascripts like this (in your load_jquery function) wp_register_script ( ‘yourscripthandle’, //string $handle: a string to identify this script get_bloginfo( ‘template_url’ ) . ‘/js/yourcustomjs.js’, //string $src: Path of your script file array (‘jquery’ ), // array $deps = … Read more

Code Executing Too Late?

Per comments, declare it global before using in both (or all) places: global $sitetype; if ( $_SERVER[“HTTP_HOST”] === “domain1.com” ) { $sitetype = one; } //etc and global $sitetype; if ( $sitetype == all ){ echo “site type 1”; } //etc

PHP include statement not working?

From your current code you do not need to include functions.php, it is automatically done Because get_1406_page_title() returns it’s output, you need to echo the result from the function if you need to display the result echo get_1406_page_title();

Jquery window.send_to_editor function

It is just a little syntax error in your window.send_to_editor function: imgurl = $( ‘img’, html ).attr( ‘src’ ); should be imgurl = $( ‘img’, $( html ) ).attr( ‘src’ ); because your html variable is neither a valid DOM nor a jQuery Element. Additional Note: If you want to use the Thickbox on multiple … Read more

Division by zero error in image.php

shutter speed is one of the exif data wordpress tries to extract from images when uploaded. If the image do not contain the info it will be zero, hence your division by zero error. Somewhere before that code you should check if the image even needs to go there. If it is not a photo … Read more