$m in pre_do_shortcode_tag

The documentation for $m is available in the function that the pre_do_shortcode_tag filter gets called in, do_shortcode_tag(): /** * … * @param array $m { * Regular expression match array. * * @type string $0 Entire matched shortcode text. * @type string $1 Optional second opening bracket for escaping shortcodes. * @type string $2 Shortcode … Read more

Generate list of posts on a page, but fill shortcode values from ACF fields on that page

I have actually found a really elegant solution to this myself. The issue is not with the [random-posts-list], it is with the script used to generate the [county] shortcode. Instead of using $post_ID = get_the_ID(); I should have been using $post_ID = get_queried_object_id();. This is a built-in WordPress query. With the above amend, I also … Read more

How to display a function inside shortcode tags

I have modified the code… function myFunction() { $output=””; $entries = get_post_meta(get_the_ID(), ‘_kad_repeat_group’, true); if (is_countable($entries) && count($entries) > 0) : foreach ((array) $entries as $key => $entry) { $title = isset( $entry[‘_kad_title_ekstra’] ) ? esc_attr($entry[‘_kad_title_ekstra’]) : ”; $output .= ‘<h4>’.$title.'</h4>’; } endif; return $output; }

Disable / hide example preview using elementor editor on page with shortcode

Always use output buffers with shortcode to ensure the content is captured and displayed only where shortcode is used. So your code will get modified as follows: add_shortcode(‘apartmentList’, function() { ob_start(); include ‘ApartmentLists/ApartmentListOne.php’; return ob_get_clean(); }); Also, if you are looking to stop the display of the shortcode content completely on the Elementor Editor, you … Read more

How to use Shortcodes?

is_product(): The is_product() function is a conditional function in WooCommerce that checks whether the current page is a single product page. It returns true if the current page is a product page, and false if it is not. ! is_product(): The exclamation mark (!) in front of is_product() is the logical “not” (negation) operator. So, … Read more

Trying to create a shortcode that displays taxonomy terms in a dropdown

This fixed my issue, hopefully it can help someone else. <?php add_shortcode(‘city_dropdown’, ‘city_taxonomy_dropdown’); function city_taxonomy_dropdown( $atts ) { // Attributes $atts = shortcode_atts(array( ‘hide_empty’ => ‘1’, // or ‘0’ ‘show_count’ => ‘0’, // or ‘0’ ‘orderby’ => ‘name’, // or ‘order’ ‘taxonomy’ => ‘city’, ), $atts, ‘city_dropdown’); ob_start(); ?> <select class=”<?php echo esc_attr($atts[‘taxonomy’]); ?>” name=”<?php … Read more

Display the progress of post achievement with percentage against target in wordpress dashboard

Here are my thoughts, which include both a shortcode and a direct function to display the post progress in the WordPress dashboard/admin area: Creating a Custom Shortcode: You can create a custom shortcode to display the post progress on your WordPress site using the following code: function post_progress_shortcode() { $post_type=”movie”; $target_count = 50000; // Set … Read more

Hata!: SQLSTATE[HY000] [1045] Access denied for user 'divattrend_liink'@'localhost' (using password: YES)