How to add button to WYSIWYG to insert shortcode with params (filled in system popup)?
How to add button to WYSIWYG to insert shortcode with params (filled in system popup)?
How to add button to WYSIWYG to insert shortcode with params (filled in system popup)?
Solved by wrapping everything in document.addEventListener(“DOMContentLoaded”, function() {} Realized it was trying to fire the script off document.addEventListener(“DOMContentLoaded”, function () { var getSiblings = function (elem) { // Setup siblings array and get the parent var siblings = []; var sibling = elem.parentNode.parentNode; // Loop through each sibling and push to the array while (sibling) … Read more
Product description is mixed in shortcodes
How can I remove the wp_autop filter from a shortcode block in a block theme page template (twenty twenty-three)?
You can use the main WP_Roles object to get an array of role names/labels, e.g. $role=”author”; $label=””; // if there is no label this will be used instead if ( wp_roles()->has_role( $role ) ) { // this protects us if the role does not exist. $role_names = wp_roles()->get_names(); $label = $role_names[$role]; // Author } echo … Read more
The default WP_Query object on the blog homepage is the feed of blog posts rather than the page itself, so you’ll need to grab the post ID manually and pass it to get_post_thumbnail_id(): function lwb_image_shortcode( $atts ) { // Attribute für den Shortcode festlegen $atts = shortcode_atts( array( ‘type’ => ‘featured’, // Welches Bild, Standard … Read more
You are getting that error because in the function parameter you are passing $content as 1st parameter but as per add_shortcode callback function it accepts 2 argument $atts – array $content – string It is basically trying to concat $atts param which is an array hence you are getting warning. Just update your code by … Read more
You need to change the_title() to get_the_title(). You are asking the shortcode to echo out a string that is returning the title. It would be good for you to research the difference between the_title and get_the_title. The main difference is that the_title is actually returning the title without any other requirement (this is simplified: there … Read more
Thanks to @fuxia, adding data to allowed protocols fixes the problem and I can happily use return. add_filter( ‘kses_allowed_protocols’, function ( $protocols ) { $protocols[] = ‘data’; return $protocols; });
You can try this: function woo_prod_categories() { if ( is_product() ) { global $post; $product_cats = get_the_terms( $post->ID, ‘product_cat’ ); if ( ! empty( $product_cats ) && ! is_wp_error( $product_cats ) ) { $cat_links = array(); foreach ( $product_cats as $product_cat ) { $cat_links[] = ‘<a href=”‘ . get_term_link( $product_cat->term_id, ‘product_cat’ ) . ‘”>’ . … Read more