Configuring WP-CLI on Windows 10

Actually, I figured out how to do this, and it’s actually really easy to do! Which is awesome because I think it’s a great simple way to work! First up, you don’t want to change the PATH for PHP in bash. So you’ll want to remove that. Instead, what you are doing is using bash … Read more

HTML table from shortcode with multiple parameters

I have created an example of how you can achive what you are after: You can use it like this : [itable data=”inv;coin;coinamount;currency#inv;coin;coinamount;currency”] function itable_shortcode( $atts ) { extract( shortcode_atts( array( ‘data’ => ‘none’, ), $atts ) ); $data = explode(‘#’,$data); $output = “”; foreach ($data as $value) { $output .= ‘<tr>’; $in_value = explode(‘;’,$value); … Read more

user_id error: Only variables should be passed by reference

There is an answer for your question right in the Codex: The first parameter of get_comment function is: $comment – (integer) (required) The ID of the comment you’d like to fetch. You must pass a variable containing an integer (e.g. $id). A literal integer (e.g. 7) will cause a fatal error (Only variables can be … Read more

fallback image for featured image

Your code looks OK and it should work just fine. But there are some things you can (and you should) fix. 1. You don’t use absolute URL for your fallback image You pass /wp/wp-content/themes/klicknet-theme/images/testbild.png as src of your image. It would be much better and more secure if you’d use WP functions in there. For … Read more

Type hinting and void return question

Callback functions for anaction hook don’t need to return anything, so based on the description here: A void return type has been introduced. Functions declared with void as their return type must either omit their return statement altogether, or use an empty return statement. NULL is not a valid return value for a void function. … Read more

WP_Query meta_query results date by date

My idea is following. 1. Get the array of all meta dates your events have. DISTINCT in the MySQL query means do not include duplicates. <?php /* * From https://wordpress.stackexchange.com/a/9451/11761 */ function get_all_possible_meta_dates( $key = ‘event_dates_wp’, $type=”page”, $status=”publish” ) { global $wpdb; $result = $wpdb->get_col( $wpdb->prepare( ” SELECT DISTINCT pm.meta_value FROM {$wpdb->postmeta} pm LEFT JOIN … Read more