Why is my shortcode not working?
Why is my shortcode not working?
Why is my shortcode not working?
I am unsure of the issue. If it is simply the text is too large, try using CSS to scale the font size. .gallery-item h3 { font-size: 1rem; }
Rather than passing the variable contents in to the shortcode, you would probably be better to pass in the URL parameter you are setting, i.e. [post color=”color” width=”980″ heigh=”610″]. Because your shortcode will execute during load in PHP, you can then tell your shortcode function to store the value of $_GET[‘color’] to later use in … Read more
I see you’re using functions such as the_permalink that echo their values, but don’t return them, yet you’re using them as if they do return values, which they don’t. Aside from a few exceptions, WP functions that start with the_ don’t return data, they echo it, so you have to use functions such as get_permalink … Read more
The answer is: function reservations_yesterday() { global $wpdb; $results = $wpdb->get_var (“SELECT SUM(`mattiscool`), booking_date FROM `wp_cbxrbooking_log_manager` WHERE `booking_date` = CURDATE() -1”); return $results; } add_shortcode(‘name’, ‘reservations_yesterday’);
You need to read the manual for the functions you’re using as all the information for how to debug is contained there. $wpdb-query() description is very clear. The return value is: (int|bool) Boolean true for CREATE, ALTER, TRUNCATE and DROP queries. Number of rows affected/selected for all other queries. Boolean false on error. As mentioned … Read more
Instead of use shortcode in your confirmation, you can use the filter hook “gform_confirmation” for manage your confirmation. After, you’ll be able to use your shortcode [useful-tools] with do_shortcode() with your confirmation. Sorry if I misunderstood your problem!
First a few notes: Shortcodes do accept arguments, so you could write [marks subject=”Biology”] (@see https://codex.wordpress.org/Shortcode_API) You should never ever pass raw data directly into a SQL statement, WordPress uses PDO, this means you can prepare statements. (@see https://developer.wordpress.org/reference/classes/wpdb/prepare/) Using the get_results will return an Array, object or null (@see https://developer.wordpress.org/reference/classes/wpdb/get_results/). There are many approaches … Read more
After realizing that I was trying to use the same shortcode for two different types of lists, it was easier to just separate them in two different shortcodes. To list all posts and break them up by type: /** * Shortcode for listing all tools matching tags * Usage: [useful-tools-all desc=”true” li=”true” tags=”health, teens”] * … Read more
Shortcodes not processing inside post content