Where to put include php file?

First of all I must say that I don’t think this is a wordpress related question. That said I hope this following suggestion helps you go in the right direction… Basically the include(“xxx-xxx.php”); already tells you where to put the xxx-xxx.php – in this case it should go into the same directory where the ‘parent’ is … Read more

Too many if’s and else if’s ?? – Must be better way [closed]

This question probably belongs to Code Review. Anyway, you can fill your event properties inside an array, which you can iterate: $events = array( ‘opening’ => array( ‘time’ => ‘…time here…’, ‘formatted_time’ => ‘…time here…’, ‘label’ => __(‘Opening:’), // or ucfirst($type) if you want… ), ‘closing’ => array( ‘time’ => ‘…time here…’, ‘formatted_time’ => ‘…time … Read more

Use ajax response in PHP function

Instead of cooking up your own PHP file and trying to bring in WordPress functionality, put the functionality inside of WordPress using the AJAX hooks that are designed to do that sort of thing. More info here: http://codex.wordpress.org/AJAX_in_Plugins

Loop on a wordpress Page instead of content coming from the WP text editor

On your custom page template, the default loop is working and that’s why the loop is fetching content from the page. You need a custom query in this case. Here’s the code. <?php $query = new WP_Query( array( ‘post_type’ => ‘post’, ‘post_status’ => ‘publish’, ) ); if ( $query->have_posts() ) { while ( $query->have_posts() ) … Read more

Check if username doesn’t exists

Got it fixed. Pretty simple actually. I moved the if part where the user get’s deleted to the bottom of the script. foreach ($data as $gebruiker){ $username = $gebruiker[‘username’]; if ( username_exists( $username ) && $gebruiker[‘status’] == ‘published’ ){ $user = get_user_by( ‘login’, $username); update_user_meta( $user->ID, ‘import_1′, $gebruiker[’email’] ); }else{ $users = wp_insert_user( array( ‘user_login’ … Read more

using a shortcode in a hyperlink

Don’t use double quotes (“) inside the shortcode, since you are using double quotes to specify the href attribute. The browser thinks your href text ends at position=. Use single quotes instead: href=”https://wordpress.stackexchange.com/reservation/?unitrate=[print_csv position=”5′]&amp;… I agree with the comments that there is a better way to do this, but I provide a potential answer anyway … Read more